Advertisement
Guest User

Untitled

a guest
Aug 17th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. **b'PING localhost (127.0.0.1) 56(84) bytes of data.n64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.106 msn64 bytes from localhost (127.0.0.1): icmp_seq=2 ttl=64 time=1.01 msn64 bytes from localhost (127.0.0.1): icmp_seq=3 ttl=64 time=0.054 msn64 bytes from localhost (127.0.0.1): icmp_seq=4 ttl=64 time=0.055 msn64 bytes from localhost (127.0.0.1): icmp_seq=5 ttl=64 time=0.052 msnn--- localhost ping statistics ---n5 packets transmitted, 5 received, 0% packet loss, time 4000msnrtt min/avg/max/mdev = 0.052/0.256/1.014/0.379 msn'**
  2.  
  3. import paramiko
  4.  
  5.  
  6. hostname = '192.168.xx.xxx'
  7. port = 22
  8. username = 'root'
  9. password = 'xxxxxxx'
  10.  
  11. if __name__ == "__main__":
  12. paramiko.util.log_to_file('paramiko.log')
  13. s = paramiko.SSHClient()
  14. s.load_system_host_keys()
  15. s.set_missing_host_key_policy(paramiko.AutoAddPolicy())
  16. s.connect(hostname, port, username, password)
  17. stdin, stdout, stderr =s.exec_command('ping localhost -c 5')
  18. print(stdout.read())
  19. s.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement