View Single Post
  #1  
Old 02-01-2019, 12:00 PM
rleon rleon is offline
Registered User
 
Join Date: Jan 2008
Posts: 116
try different passwords

I have this script that works great to do different things

but lately there were some hosts that have old passwords .,. pass2 and pas3

I trying to add a simple way for it to try pass2 and pass3 if needed until it gets to
crt.Screen.WaitForString("]# ")

any advice / help is welcome.


Code:
# $language = "python"
# $interface = "1.0"

def main():
        crt.Screen.Synchronous = False
with open('/hosts') as hosts_:
        for host in hosts_:
                crt.Screen.WaitForString("working # ")
                crt.Screen.Send("ssh -oStrictHostKeyChecking=no root@" + host + '\r')
                crt.Screen.WaitForString("word: ")
                crt.Screen.Send("pass1" + chr(13))

                crt.Screen.WaitForString("]# ")
                crt.Screen.Send("uname -a;df -h" + chr(13))
                crt.Screen.WaitForString("]# ")
                crt.Screen.Send("exit" + chr(13))

main()
Reply With Quote