@myles
        
        2018-08-02T16:40:40.000000Z
        字数 515
        阅读 774
    未分类
学习参考:http://www.ywnds.com/?p=11494
https://www.youtube.com/watch?v=CKVMwte8Z-s
# coding:utf-8import paramikodef sshclient():client = paramiko.SSHClient()client.set_missing_host_key_policy(paramiko.AutoAddPolicy())client.connect(hostname="192.168.31.56", port=22, username="myles", password="toor", timeout=10)stdin,stdout,stderr = client.exec_command('ifconfig')client.close()return stdoutstdout = 1n = 0try:while stdout:sshclient()if stdout:n += 1print("登录{}成功...".format(n))except:print("登录{}次时,测试失败...".format(n))