View Single Post
Old 09-12-2018, 10:36 AM
rleon rleon is offline
Registered User
Join Date: Jan 2008
Posts: 110
script to SSH to host

def main():
        crt.Screen.Synchronous = False
with open('/Users/rleon16/hosts') as hosts_:
        for host in hosts_:
                crt.Screen.WaitForString("working # ")
                crt.Screen.Send("ssh -oStrictHostKeyChecking=no root@" + host + ps -ef | grep gofer + '\r')
                crt.Screen.WaitForString("word: ")
                crt.Screen.Send("mypass!" + chr(13))

/Users/rleon16/hosts is a list of hostnames.

I am trying to string a ssh command but getting an error.

I just want it to run the command and loop through.

Any ideas?
Reply With Quote