-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathunicom_sign.py
More file actions
188 lines (172 loc) · 8.07 KB
/
unicom_sign.py
File metadata and controls
188 lines (172 loc) · 8.07 KB
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
# coding=utf-8
import os
import re
from time import sleep
import datetime
import requests
from Crypto.PublicKey import RSA
from Crypto.Cipher import PKCS1_v1_5 as Cipher_pkcs1_v1_5
import base64
from requests import post
# 此处改为自己的配置 手机号, 密码, appId
import notify
passwordList = eval(os.getenv('UNICOM_PHONE_PASSWORD'))
pid = '06eccb0b7c2fd02bc1bb5e8a9ca2874197a104f42e22550f2855713d335110d690070fc3b7cdb379a715c35128eb6f959f989741fb07cde1a0d6e9c6c58700b966c9a65f2059674beb29712f12fe8b8b'
class UnicomSign():
def __init__(self):
self.UA = None
self.VERSION = '8.0200'
self.request = requests.Session()
self.resp = '联通营业厅签到通知 \n'
self.pid = pid
# 加密算法
def rsa_encrypt(self, str):
# 公钥
publickey = '''-----BEGIN PUBLIC KEY-----
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDc+CZK9bBA9IU+gZUOc6
FUGu7yO9WpTNB0PzmgFBh96Mg1WrovD1oqZ+eIF4LjvxKXGOdI79JRdve9
NPhQo07+uqGQgE4imwNnRx7PFtCRryiIEcUoavuNtuRVoBAm6qdB0Srctg
aqGfLgKvZHOnwTjyNqjBUxzMeQlEC2czEMSwIDAQAB
-----END PUBLIC KEY-----'''
rsakey = RSA.importKey(publickey)
cipher = Cipher_pkcs1_v1_5.new(rsakey)
cipher_text = base64.b64encode(cipher.encrypt(str.encode('utf-8')))
return cipher_text.decode('utf-8')
# 用户登录
def login(self, mobile, passwd):
self.UA = 'Mozilla/5.0 (Linux; Android 9; MI 6 Build/PKQ1.190118.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/80.0.3987.99 Mobile Safari/537.36; unicom{version:android@' + self.VERSION + ',desmobile:' + mobile + '};devicetype{deviceBrand:Xiaomi,deviceModel:MI 6};{yw_code:}'
timestamp = datetime.datetime.now().strftime('%Y%m%d%H%M%S')
headers = {
'Host': 'm.client.10010.com',
'Accept': '*/*',
'Content-Type': 'application/x-www-form-urlencoded',
'Connection': 'keep-alive',
'Cookie': 'devicedId=20be54b981ba4188a797f705d77842d6',
'User-Agent': self.UA,
'Accept-Language': 'zh-cn',
'Accept-Encoding': 'gzip',
'Content-Length': '1446'
}
login_url = 'https://m.client.10010.com/mobileService/login.htm'
login_data = {
"deviceOS": "android9",
"mobile": self.rsa_encrypt(mobile),
"netWay": "Wifi",
"deviceCode": "20be54b981ba4188a797f705d77842d6",
"isRemberPwd": 'true',
"version": "android@" + self.VERSION,
"deviceId": "20be54b981ba4188a797f705d77842d6",
"password": self.rsa_encrypt(passwd),
"keyVersion": 1,
"provinceChanel": "general",
"appId": self.pid,
"deviceModel": "MI 6",
"deviceBrand": "Xiaomi",
"timestamp": timestamp
}
res1 = self.request.post(login_url, data=login_data, headers=headers)
if res1.status_code == 200:
print(">>>获取登录状态成功!")
self.resp += '>>>获取登录状态成功!\n'
else:
print(">>>获取登录状态失败!")
self.resp += '>>>获取登录状态失败!\n'
sleep(1)
# 每日签到领积分、1g流量日包
def daysign(self):
headers = {
"user-agent": self.UA,
"referer": "https://img.client.10010.com",
"origin": "https://img.client.10010.com"
}
res0 = self.request.post("https://act.10010.com/SigninApp/signin/getIntegral", headers=headers)
if res0.json()['status'] == '0000':
print(">>>签到前积分:" + res0.json()['data']['integralTotal'])
self.resp += ">>>签到前积分:" + res0.json()['data']['integralTotal'] + '\n'
else:
print(">>>获取积分信息失败!")
self.resp += '获取积分信息失败' + '\n'
res1 = self.request.post("https://act.10010.com/SigninApp/signin/getContinuous", headers=headers)
if res1.json()['data']['todaySigned'] == '1':
res2 = self.request.post("https://act.10010.com/SigninApp/signin/daySign", headers=headers)
print('>>>签到成功!')
self.resp += '>>>签到成功!\n'
else:
print('>>>今天已签到!')
self.resp += '>>>今天已签到!\n'
# 看视频,积分翻倍
# sleep(3)
res4 = self.request.post("https://act.10010.com/SigninApp/signin/getIntegral", headers=headers)
if res4.json()['status'] == '0000':
print(">>>签到后积分:" + res4.json()['data']['integralTotal'])
self.resp += ">>>签到后积分:" + res4.json()['data']['integralTotal'] + '\n'
else:
print(">>>获取积分信息失败!")
self.resp += '>>>获取积分信息失败!\n'
# 每日领取1G流量日包
res5 = self.request.post("https://act.10010.com/SigninApp/doTask/finishVideo", headers=headers)
res6 = self.request.post("https://act.10010.com/SigninApp/doTask/getTaskInfo", headers=headers)
res7 = self.request.post("https://act.10010.com/SigninApp/doTask/getPrize", headers=headers)
if res7.json()['status'] == '0000':
print(">>>1G流量日包领取成功!")
self.resp += '>>>1G流量日包领取成功!\n'
else:
print(">>>1G流量日包任务失败!")
self.resp += '>>>1G流量日包任务失败!\n'
# 每日任务
def daytask(self):
headers = {
"user-agent": self.UA,
"referer": "https://img.client.10010.com",
"origin": "https://img.client.10010.com"
}
# 娱乐中心--每日打卡
data1 = {
'methodType': 'signin',
'clientVersion': self.VERSION,
'deviceType': 'Android',
}
res1 = self.request.post("https://m.client.10010.com/producGame_signin", data=data1, headers=headers)
res1.encoding = 'utf-8'
print(">>>每日打卡:", res1.json()['respDesc'])
self.resp += ">>>每日打卡:" + res1.json()['respDesc'] + '\n'
# 沃之树任务
res5 = self.request.post("https://m.client.10010.com/mactivity/arbordayJson/arbor/3/0/3/grow.htm",
headers=headers)
print(">>>每日浇水:", res5.json()['msg'])
self.resp += ">>>每日浇水:" + res5.json()['msg'] + '\n'
# 签到看视频,下载APP流量奖励
print(">>>签到看视频,下载APP流量奖励任务开始...")
data5 = {
'stepflag': 22
}
data6 = {
'stepflag': 23
}
for i in range(3):
res5 = self.request.post("https://act.10010.com/SigninApp/mySignin/addFlow", data=data5, headers=headers)
sleep(3)
res6 = self.request.post("https://act.10010.com/SigninApp/mySignin/addFlow", data=data6, headers=headers)
print(">>>签到看视频,下载APP流量奖励任务完成!")
# 金币抽奖免费3次
res7 = self.request.post("https://m.client.10010.com/dailylottery/static/textdl/userLogin", headers=headers)
data8 = {
'usernumberofjsp': re.findall(r"encryptmobile=(.+?)';", res7.text)[0],
'flag': 'convert'
}
# for i in range(3):
# res8 = self.request.post("https://m.client.10010.com/dailylottery/static/doubleball/choujiang", data=data8,
# headers=headers)
# if res8.status_code == 200:
# print(">>>金币抽奖:", res8.json()['RspMsg'])
# self.resp += ">>>金币抽奖:" + res8.json()['RspMsg'] + '\n'
# sleep(3)
if __name__ == '__main__':
notifyStr = ""
for (phone, password) in passwordList:
user = UnicomSign()
user.login(phone, password) # 用户登录 这里需要更改
user.daysign() # 日常签到领积分,1g流量日包
user.daytask() # 日常任务
notifyStr += phone + os.linesep + user.resp
notify.send('联通营业厅签到通知', notifyStr)