Advertisement
Guest User

Untitled

a guest
Mar 24th, 2017
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. import paramiko
  2. import time
  3.  
  4. strComputer = '10.0.6.35'
  5. strUser = 'UserID'
  6. strPwd = 'WackyPassword'
  7.  
  8. client = paramiko.SSHClient()
  9. client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
  10. client.connect(hostname=strComputer, username=strUser, password=strPwd)
  11.  
  12. channel = client.invoke_shell()
  13. time.sleep(3)
  14. channel.send('ls n')
  15. time.sleep(3)
  16. output = channel.recv(2024)
  17. print(output)
  18.  
  19. # Close the connection
  20. client.close()
  21. print('Connection closed.')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement