Advertisement
weskker

SSH

Sep 17th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. import paramiko
  2.  
  3. ssh = paramiko.SSHClient()
  4. ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
  5. ssh.connect('200.204.1.4', 22, username="", password="")
  6. stdin, stdout, stderr = ssh.exec_command("grep bob /etc/hosts")
  7. out = stdout.readlines()
  8.  
  9. file = open("GESA.txt", "w+")
  10.  
  11. for line in out:
  12. file.write(line)
  13.  
  14. file.close()
  15. # print("comand executted")
  16. # print("out")
  17. ssh.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement