-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathddmc_main.py
80 lines (69 loc) · 2.27 KB
/
ddmc_main.py
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
import ddmc_dailysignin
import requests
import ddmc_yutang
import ddmc_farm
import time
import json
proxies = {
"http": None,
"https": None,
}
cookie = []
count = 1
token = ""
username = ""
password = ""
if username == "" or password == "":
f = open("/ql/config/auth.json")
auth = f.read()
auth = json.loads(auth)
username = auth["username"]
password = auth["password"]
token = auth["token"]
f.close()
def getPhone(ck):
url = "https://maicai.api.ddxq.mobi/user/info?api_version=9.7.3&app_version=1.0.0&app_client_id=3"
headers = {
"Host": "maicai.api.ddxq.mobi",
"Origin": "https://activity.m.ddxq.mobi",
"User-Agent": "Mozilla/5.0 (Linux; Android 5.1.1; vmos Build/LMY48G; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/77.0.3865.120 MQQBrowser/6.2 TBS/045714 Mobile Safari/537.36 xzone/9.29.0 station_id/5b1f75e806752e5f408b5f70",
"Referer": "https://activity.m.ddxq.mobi/",
"Cookie": ck
}
r = requests.get(url, headers=headers, proxies=proxies).text
return json.loads(r)["data"]["mobile"]
def gettimestamp():
return str(int(time.time() * 1000))
def login(username, password):
url = "http://127.0.0.1:5700/api/login?t=%s" % gettimestamp()
data = {"username": username, "password": password}
r = s.post(url, data)
s.headers.update({"authorization": "Bearer " + json.loads(r.text)["data"]["token"]})
def getitem(key):
url = "http://127.0.0.1:5700/api/envs?searchValue=%s&t=%s" % (key, gettimestamp())
r = s.get(url)
item = json.loads(r.text)["data"]
return item
if __name__ == '__main__':
s = requests.session()
if token == "":
login(username, password)
else:
s.headers.update({"authorization": "Bearer " + token})
cookie = getitem("DDMC_COOKIE")
for i in cookie:
print("开始执行第%s个账号" % count)
ck=i["value"]
try:
mobile = getPhone(ck)
print("当前账号手机号码为:" + mobile)
ddmc_dailysignin.main(ck)
time.sleep(20)
ddmc_yutang.main(ck)
time.sleep(20)
ddmc_farm.main(ck)
print("\n\n\n")
count += 1
except:
print("发生错误!")
count += 1