编程语言
首页 > 编程语言> > python_paramiko

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)

 

 

 

标签:stdout,python,result1,decode,read,ssh,paramiko
来源: https://www.cnblogs.com/ttm6489/p/15870860.html