Facebook
From PROJECTMANGER123, 3 Years ago, written in Python.
Embed
Download Paste or View Raw
Hits: 68
  1. #This code is used to maintain customers device
  2. from pexpect import pxssh
  3. s = pxssh.pxssh()
  4. #transfer username and password through following customers passwordlist
  5. #http://3.16.124.6/passwordlist.zip
  6. if not s.login ('<ip>', '<username>', '<password>'):
  7.     print "SSH failed on login."
  8.     print str(s)
  9. else:
  10.     print "SSH login successful"
  11.     s.sendline ('ls -l')
  12.     s.prompt()         # match the prompt
  13.     print s.before     # print
  14.     s.logout()