ملاحظة: قمت بإعداد هذا السكريبت بشكل سريع بسبب حاجتي له في العمل فأرجو من كل من وجد أي مشكلة أن يخبرني
أعتذر عن الانقطاع الطويل و اللذي لم ينتهي بعد لكني قد كتبت السكريبت من فتره و لم أضعه لهذا أحببت أن أضعه لعله ينفع أحد إما باستخدامه أو أن يستفيد من أي شئ في الكود
كود PHP:
.: أنقر هنا لتحديد الكل :.
#!/bin/bash
clear
echo " # ############################################### #"
echo " # #"
echo " # SSH Auth. for Single/Multi Machine(s) #"
echo " # ----------------------------------------------- #"
echo " # Author : Eng.Sabri #"
echo " # Created in : Sat Aug 8 2009 02:10 pm #"
echo " # Last Modify: Tus Jan 25 2011 10:40 am #"
echo " # ############################################### #"
COLORIZING()
{
# Text color variables
txtund=$(tput sgr 0 1) # Underline
txtbld=$(tput bold) # Bold
txtred=$(tput setaf 1) # Red
txtgrn=$(tput setaf 2) # Green
txtylw=$(tput setaf 3) # Yellow
txtblu=$(tput setaf 4) # Blue
txtpur=$(tput setaf 5) # Purple
txtcyn=$(tput setaf 6) # Cyan
txtwht=$(tput setaf 7) # White
txtrst=$(tput sgr0) # Text reset
# Colored Texts
echo -e $(tput sgr0) # Reset All Colors
}
function message {
COLORIZING
if [ $WELCOME = 1 ]
then
echo Hello $(logname)
echo ""
sleep 1
else
echo "no welcome msg for you :P"
fi
}
function INFORMATIONS {
COLORIZING
read -p " [+] Pleas Enter your Local Host User Name: " LUSER
read -p " [+] Pleas Enter your Remote Host User Name witch you need to Connetc: " RUSER
echo -e $(tput setaf 1)
echo "#---------------------------#"
echo "Notic:If you've list of IP's"
echo " Put the IP's in text file"
echo " Each IP in New Line!"
echo " No Empty Lines!"
echo " No Spaces!"
echo "#---------------------------#"
echo -e $(tput sgr0)
read -p " [+] Pleas Enter Remote Host's IP address or IP's List File path : " IPADDR
read -p " [+] Pleas Enter SSH's port used on Remote Host: " RPORT
# Review
clear
echo -e $(tput setaf 2)
echo "=---------------------="
echo " Information Review.. "
echo "=---------------------="
echo " [+] Local Host User Name Is.." $LUSER
echo " [+] Remote Host User Name Is.." $RUSER
echo " [+] Remote Host(s) IP/List Is.." $IPADDR
echo " [+] Remote Host User Port Is.." $RPORT
echo -e $(tput sgr0)
read -p " [!] Is this information correct [y or n]? " INFO
while [ $INFO = "n" ]
do
clear
echo " "
echo "=-----------------------------------="
echo " Please, Re-Enter Your Information.. "
echo "=-----------------------------------="
echo " "
read -p " [+] Pleas Enter your Local Host User Name: " LUSER
read -p " [+] Pleas Enter your Remote Host User Name witch you need to Connect: " RUSER
read -p " [+] Pleas Enter Remote Host's IP address or IP's List File path: " IPADDR
read -p " [+] Pleas Enter SSH's port used on Remote Host: " RPORT
# Review
clear
echo -e $(tput setaf 2)
echo "=---------------------="
echo " Information Review.. "
echo "=---------------------="
echo " [+] Local Host User Name Is.." $LUSER
echo " [+] Remote Host User Name Is.." $RUSER
echo " [+] Remote Host(s) IP/List Is.." $IPADDR
echo " [+] Remote Host User Port Is.." $RPORT
echo -e $(tput sgr0)
read -p " [!] Is this information correct [y or n]? " INFO
done
sleep 1
}
function PKG {
COLORIZING
# Encryption
read -p " [+] Pleas Chose the Encryption Type [rsa , des] " ENC
ssh-keygen -t $ENC
# Check is it List Of IP's or Just One IP
if [ -f $IPADDR ]
then
for LIST in $(cat $IPADDR)
do
if [ $USER = 'root' ]; then
scp -P $RPORT /root/.ssh/id_rsa.pub $RUSER@$LIST:.ssh/authorized_keys
# exit 0
else
scp -P $RPORT /home/$LUSER/.ssh/id_rsa.pub $RUSER@$LIST:.ssh/authorized_keys
fi
done
else
if [ $USER = 'root' ]; then
scp -P $RPORT /root/.ssh/id_rsa.pub $RUSER@$IPADDR:.ssh/authorized_keys
exit 0
else
scp -P $RPORT /home/$LUSER/.ssh/id_rsa.pub $RUSER@$IPADDR:.ssh/authorized_keys
fi
fi
}
INFORMATIONS
PKG
echo -e $(tput setaf 6)
echo " "
echo "--------------------------------------"
echo " Regards & Respect Good Bye $(logname)"
echo "--------------------------------------"
echo -e $(tput sgr0)
sleep 3
exit
تحياتي واحترامي


Menu
Cat Widget