python_paramiko

 

# author: Roy.G
import paramiko
ssh =paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy)
ssh.connect(hostname='192.168.188.101',port=22,username='root',password='123456')
stdin,stdout,stderr=ssh.exec_command('ip addr')
result=stdout.read().decode()
result1=stderr.read().decode()
print('out: ', result)
print('err: ',result1)

 

 

 

posted on 2022-02-08 12:59  ttm6489  阅读(21)  评论(0编辑  收藏  举报

导航