import paramiko
import socket
x = socket.getaddrinfo('localhost', 8080)
print(x)
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect('192.168.1.178', port=22, username='root', password='marek1983')
stdin, stdout, stderr = (ssh.exec_command("uptime"))
output = stdout.readlines()
print('\n'.join(output))
output:
C:\Python27\python.exe C:/Users/Y700-15/PycharmProjects/python/remcon.py
[(23, 0, 0, '', ('::1', 8080, 0, 0)), (2, 0, 0, '', ('127.0.0.1', 8080))]
21:52:18 up 2:00, 1 user, load average: 0,00, 0,01, 0,05
Process finished with exit code 0
Brak komentarzy:
Prześlij komentarz