标签:log class gre color oca clock who txt read
#ping whole local domain
for ip in {1..255};do ping -c 3 192.168.110.$ip >> ping.log;done grep ‘3 ttl‘ ping.log |awk ‘{print $4}‘ | sed ‘s\:\\g‘ |while read ip;do echo $ip >> ips.txt;done cat ips.txt|while read ip;do ssh $ip ;done
#get correct password from pwd array
while IFS= read -r ip do echo "testing $ip" >> result.txt while IFS= read -r pwd do timeout 1s sshpass -p $pwd ssh $ip "exit" && echo -e "$ip \t $pwd" >> /root/result.txt && break done<pwds done<ips
#excute command on remote
function SyncTime() { sshpass -p $2 ssh -tt $1 << EOF date -s "`date`" hwclock -w exit 0 EOF } while IFS= read -r line do ip=`echo $line | awk -F ‘ ‘ ‘{print $1}‘` pw=`echo $line | awk -F ‘ ‘ ‘{print $2}‘` SyncTime $ip $pw done<pwds.txt exit 0
标签:log class gre color oca clock who txt read
原文地址:https://www.cnblogs.com/samwang10/p/14838388.html