2017.8.2 python black hat

来源:互联网 发布:淘宝高达模型店 编辑:程序博客网 时间:2024/05/16 12:56
#-*- coding:utf-8 -*-import threadingimport paramikoimportsubprocessdef ssh_command(ip,user,passwd,command):client=paramiko.SSHClient()#client.load_host_keys('/home/justin/.ssh/know_hosts')client.set_missing_host_key_policy(paramiko.AutoAddPolicy())client.connect(ip,username=user,password=passwd)ssh_session=client.get_transport().open_session()ifssh_session.active:ssh_session.exec_command(command)printssh_session.recv(1024)returnssh_command('192.168.220.131','root','haojide0.0','id')

python2 有问题

python3 没问题