Advertisement
Guest User

Untitled

a guest
Sep 11th, 2017
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. #!/usr/bin/env python
  2. import paramiko
  3.  
  4.  
  5. IP = '127.0.0.1'
  6.  
  7.  
  8. def main():
  9. client = paramiko.SSHClient()
  10. client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
  11. client.connect(IP, port=22, username='admin', password='admin')
  12. stdin, stdout, stderr = client.exec_command('ls -l /tmp/')
  13.  
  14. output_lines = stdout.readlines()
  15. client.close()
  16.  
  17. for l in output_lines:
  18. print l.strip()
  19.  
  20.  
  21. if __name__ == "__main__":
  22. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement