Advertisement
Guest User

Untitled

a guest
Nov 11th, 2016
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. import paramiko
  2. from paramiko_expect import SSHClientInteraction
  3.  
  4. remote_conn_pre = paramiko.SSHClient()
  5. remote_conn_pre.set_missing_host_key_policy(paramiko.AutoAddPolicy())
  6. remote_conn_pre.connect(ip, username=username, password=password, allow_agent=False, look_for_keys=False)
  7.  
  8. print ("SSH connection established to %s" % ip)
  9.  
  10. interact = SSHClientInteraction(remote_conn_pre,timeout=100,display=True)
  11. interact.expect()
  12. interact.send(command)
  13. cmd_output_uname = interact.current_output_clean
  14. print cmd_output_uname
  15.  
  16. pktgen@pktgen:~$
  17. Traceback (most recent call last):
  18. File "C:Python27paramikores.py", line 29, in <module>
  19. interact.expect()
  20. File "buildbdist.win32eggparamiko_expect.py", line 119, in expect
  21. current_buffer = self.channel.recv(self.buffer_size)
  22. File "C:Python27libsite-packagesparamikochannel.py", line 615, in recv
  23. raise socket.timeout()
  24. timeout
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement