Guest User

Untitled

a guest
Jun 15th, 2016
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. # Very simple SSH client for Pythonista
  2. import paramiko
  3. import console
  4.  
  5. ssh = paramiko.SSHClient()
  6. ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
  7. host = console.input_alert('Connect to')
  8. user, passwd = console.login_alert('Login')
  9. ssh.connect(host, username=user, password=passwd)
  10. print 'Connected to %s. Type `exit` to disconnect.' % host
  11. while True:
  12. cmd = raw_input()
  13. if cmd == 'exit':
  14. break
  15. stdin, stdout, stderr = ssh.exec_command(cmd)
  16. print stdout.read()
  17. ssh.close()
  18. print 'Disconnected.'
Add Comment
Please, Sign In to add comment