View Single Post
Posts: 200 | Thanked: 300 times | Joined on Nov 2009 @ The Netherlands
#215
@ pigro & SaintGermain:

SMSCON uses the straight shell command interface for connecting with ssh.

Python ssh part in SMSCON:

Code:
(Output, ExitStatus) = pexpect.run( 'ssh -n -N -T -f -p %s -R %s:%s:%s %s@%s &' % (REMOTEPORT, LocalPort, LocalHost, REMOTEPORT, REMOTEUSER, REMOTEHOST), events = { '(?i)password':REMOTEPASSWORD + '\n', '(?i)(yes/no) ?':'yes' + '\n' }, withexitstatus = True )


SSH is started in background (in red) and when SSH ask for password it's automatically entered (green) and the connection has started if 'ExitStatus' returns 0). It's very basic done, I know, but It works.

If somebody has better code to implement in SMSCON please share it.