View Single Post
Old 02-01-2019, 01: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.

# $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))

Reply With Quote