from paramiko import SSHClient, AutoAddPolicy
hostname = '127.0.0.1'
username = 'admin'
password = 'password'
client = SSHClient()
client.set_missing_host_key_policy(AutoAddPolicy())
client.connect(hostname, port = 22,
username = username,
password = password,
look_for_keys = False,
allow_agent = False)
device_access = client.invoke_shell()
device_access.send(b'ls -lh\n')
output = device_access.recv(65000)
print(output.decode('ascii'))
client.close
No comments:
Post a Comment