Welcome to the VanDyke Software Forums

Join the discussion today!

Go Back   VanDyke Software Forums > SecureCRT on the Mac


Thread Tools Display Modes
Prev Previous Post   Next Post Next
Old 09-12-2018, 09:36 AM
rleon rleon is offline
Registered User
Join Date: Jan 2008
Posts: 116
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

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT -6. The time now is 09:53 PM.