forked from mylovedonotcry/bienaoccc_hym
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ym_dxqd.py
205 lines (171 loc) · 6.18 KB
/
ym_dxqd.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
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
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
# -*- coding: utf-8 -*-
import base64
import requests,json
import time
from Crypto.Cipher import AES
from binascii import b2a_hex, a2b_hex
from Crypto.Util.Padding import pad
# 青龙安装依赖 pycryptodome
# 安卓用HttpCanary去微信小程序抓包,只能抓用户中心home_info_body的包。
# ios可用Thor去电信营业厅app抓包,Thor可抓所有包,可以PDD买账号下载。Stream无法抓包,其它抓包软件自测。
# 抓包数据填脚本里
# 手机号
config_list = [
{"mobile": "", "food": True}
]
# 用户中心
# 抓包url https://wapside.189.cn:9001/jt-sign/api/home/homeInfo
# home_info_body {"para":"xx"}
home_info_body = {}
# 喂宠物
# https://wapside.189.cn:9001/jt-sign/paradise/food
# food_body {"para":"xx"}
food_body = {}
# 分享
# https://dxhd.189.cn:7081/actcenter/v1/goldcoinuser/shareToGetCoin.do
# share_body = {
# 'activityId': 'telecomrecommend01',
# 'session': 'xxx'
# }
share_body = {}
# 云盘
# 'https://wapside.189.cn:9001/jt-sign/paradise/polymerize'
# cloud_body = {"para":"xx"}
cloud_body = {}
# 种树
# 'https://wapside.189.cn:9001/jt-sign/paradise/polymerize'
# tree_body = {"para":"xx"}
tree_body = {}
msg = []
def telegram_bot(title, content):
print("\n")
title = title # 改成你要的标题内容
content = content # 改成你要的正文内容
bot_token = ''
user_id = ''
print("tg服务启动")
url=f"https://api.telegram.org/bot{bot_token}/sendMessage"
headers = {'Content-Type': 'application/x-www-form-urlencoded'}
payload = {'chat_id': str(user_id), 'text': f'{title}\n\n{content}', 'disable_web_page_preview': 'true'}
proxies = None
response = requests.post(url=url, headers=headers, params=payload, proxies=proxies).json()
if response['ok']:
print('推送成功!')
else:
print('推送失败!')
def encrypt(text):
key = '34d7cb0bcdf07523'.encode('utf-8')
cipher = AES.new(key, AES.MODE_ECB)
pad_pkcs7 = pad(text.encode('utf-8'), AES.block_size, style='pkcs7') # 选择pkcs7补全
cipher_text = cipher.encrypt(pad_pkcs7)
return b2a_hex(cipher_text)
def telecom_task(config):
mobile = config['mobile']
msg.append(mobile + " 开始执行任务...")
h5_headers = get_h5_headers(mobile)
# 获取用户中心
home_info_ret = requests.post(url="https://wapside.189.cn:9001/jt-sign/api/home/homeInfo", json=home_info_body, headers=h5_headers).json()
if home_info_ret['resoultMsg'] != "成功":
msg.append(home_info_ret['resoultMsg'])
return
user_id = home_info_ret['data']['userInfo']['userThirdId']
old_coin = home_info_ret['data']['userInfo']['totalCoin']
# 签到
t = time.time()
time1 = int(round(t * 1000))
body_json = {
"phone": f"{mobile}",
"date": time1,
"signSource": "smlprgrm"
}
body_str = json.dumps(body_json)
s = str(encrypt(body_str),'utf-8')
sign_body = {
"encode": s
}
sign_ret = requests.post(url="https://wapside.189.cn:9001/jt-sign/api/home/sign", json=sign_body,
headers=h5_headers).json()
if sign_ret['data']['code'] == 1:
msg.append("签到成功, 本次签到获得 " + str(sign_ret['data']['coin']) + " 豆")
else:
msg.append(sign_ret['data']['msg'])
#share
share(config)
time.sleep(1)
# 获取用户中心
home_info_ret = requests.post(url="https://wapside.189.cn:9001/jt-sign/api/home/homeInfo", json=home_info_body,
headers=h5_headers).json()
new_coin = home_info_ret['data']['userInfo']['totalCoin']
msg.append("领取完毕, 现有金豆: " + str(new_coin))
msg.append("本次领取金豆: " + str(new_coin - old_coin))
time.sleep(1)
# 喂食
food(config)
msg.append("----------------------------------------------")
def food(config):
if config['food']:
mobile = config['mobile']
msg.append(mobile + " 开始执行喂食...")
while True:
food_ret = requests.post(url="https://wapside.189.cn:9001/jt-sign/paradise/food", json=food_body,
headers=get_h5_headers(mobile)).json()
msg.append(food_ret['resoultMsg'])
if food_ret['resoultCode'] != '0':
break
#分享
def share(config):
mobile = config['mobile']
msg.append(mobile + "开始执行分享...")
url = 'https://dxhd.189.cn:7081/actcenter/v1/goldcoinuser/shareToGetCoin.do'
resp = requests.post(url=url,data=share_body,headers=get_h5_headers(mobile))
print('share==============')
print(resp)
result = resp.text
print(result)
msg.append("分享" + result)
cloud(mobile)
time.sleep(2)
tree(mobile)
# cloud
def cloud(mobile):
msg.append(mobile + "访问云盘...")
url='https://wapside.189.cn:9001/jt-sign/paradise/polymerize'
resp = requests.post(url=url, json=cloud_body, headers=get_h5_headers(mobile))
print('cloud=========')
print(resp)
result = resp.json()
print(result)
if result['resoultCode'] ==0:
msg.append("云盘"+result['resoultMsg'])
else:
msg.append("云盘访问失败"+result['resoultMsg'])
# tree
def tree(mobile):
msg.append(mobile + "种树...")
url='https://wapside.189.cn:9001/jt-sign/paradise/polymerize'
resp = requests.post(url=url, json=tree_body, headers=get_h5_headers(mobile))
print('tree=========')
print(resp)
result = resp.json()
print(result)
if result['resoultCode'] ==0:
msg.append("种树"+result['resoultMsg'])
else:
msg.append("种树访问失败"+result['resoultMsg'])
def get_h5_headers(mobile):
base64_mobile = str(base64.b64encode(mobile[5:11].encode('utf-8')), 'utf-8').strip(r'=+') + "!#!" + str(
base64.b64encode(mobile[0:5].encode('utf-8')), 'utf-8').strip(r'=+')
return {"User-Agent": "CtClient;9.2.0;Android;10;MI 9;" + base64_mobile}
def format_msg():
str = ''
for item in msg:
str += item + "\r\n"
return str
def main_handler():
for config in config_list:
telecom_task(config)
content = format_msg()
print(content)
telegram_bot('电信签到任务', content)
return content
main_handler()