Advertisement
Guest User

Untitled

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