Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- **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'**
- import paramiko
- hostname = '192.168.xx.xxx'
- port = 22
- username = 'root'
- password = 'xxxxxxx'
- if __name__ == "__main__":
- paramiko.util.log_to_file('paramiko.log')
- s = paramiko.SSHClient()
- s.load_system_host_keys()
- s.set_missing_host_key_policy(paramiko.AutoAddPolicy())
- s.connect(hostname, port, username, password)
- stdin, stdout, stderr =s.exec_command('ping localhost -c 5')
- print(stdout.read())
- s.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement