Advertisement
Guest User

Untitled

a guest
Mar 18th, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. #!/usr/bin/python
  2. import sys
  3. sys.modules['gssapi'] = None
  4. import paramiko
  5.  
  6. ssh = paramiko.SSHClient()
  7. ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
  8. try:
  9. ssh.connect(osHost, username='root', password=osPassw, port=22)
  10. except paramiko.SSHException:
  11. print "Connection to OS CLI Failed. Probably wrong password." + osHost
  12. quit()
  13. stdin, stdout, stderr = ssh.exec_command(command)
  14. commandOut = stdout.readlines()
  15. print commandOut
  16. ssh.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement