This commit is contained in:
Ytong
2024-07-01 16:16:52 +08:00
parent 4a9d3519dc
commit da0234a540
10 changed files with 23832 additions and 15 deletions

171
ddgy.py Normal file
View File

@@ -0,0 +1,171 @@
"""
滴滴果园
入口:微信小程序->滴滴出行->首页->领车费->免费领水果(中间左右滑动那里)
或者滴滴出行APP->免费领水果
变量:
ddgyToken: 必填账号token多账号换行或者@隔开格式uid&token。uid可随便填主要是方便区分账号用
青龙捉任意game.xiaojukeji.com的包把请求里面的D-Header-T用填到变量ddgyToken
uid其实不重要只是用来区分token所属的账号方便重写。手动捉包的话uid随便填都可以
多账号换行或者@隔开,重写多账号直接换号捉就行
export ddgyToken='uid&token'
cron: 28 0,8,12,18 * * *
const $ = new Env('MK滴滴果园');
"""
import requests
import re
import os
import time
response = requests.get("https://mkjt.jdmk.xyz/mkjt.txt")
response.encoding = 'utf-8'
txt = response.text
print(txt)
def main(uid,token):
print('=================================')
print(f'正在执行账号:{uid}')
try:
xx = cxguosju(uid,token)
if xx != None:
gs,jd,sd=xx
print(f'种植状态:{gs}-目前进度:{jd}')
try:
gsqd(uid,token)
except Exception as e:
print('签到出错')
try:
gscnlsd(uid,token)
except Exception as e:
print('吹牛出错')
try:
gskbx(uid,token)
except Exception as e:
print('开宝箱出错')
try:
print('--------做任务---------')
cxrw(uid,token)
print('--------做任务结束---------')
except Exception as e:
print('有请,下一位')
else:
print('种树吧……')
except Exception as e:
print('有请,下一位')
#查水滴浇水
try:
xx = cxguosju(uid,token)
if xx != None:
gs,jd,sd=xx
print(f'目前水滴:{sd}')
print(f'可浇水:{sd//10}')
for xx in range(sd//10):
print(f"{xx+1}次浇水-目前进度:{jsjs(uid,token)}")
else:
print('种树吧……')
except Exception as e:
print('有请,下一位')
#吹牛领水滴
def gscnlsd(uid,token):
print('----------')
while True:
time.sleep(3)
data = {"xbiz":"240301","prod_key":"didi-orchard","xpsid":"b7b5ec0727fb4c8ea230ed1243c61c79","dchn":"078Je67","xoid":"ce8cef18-738a-4a72-b1e2-63727ff0ad3f","xenv":"wxmp","xspm_from":"welfare-center.none.c1324.none","xpsid_root":"8a334bb6264f4360ba8a917f65520d3b","xpsid_from":"f1bd01f08f3b42c682d3f1058ba838a8","xpsid_share":"","platform":1,"token":token,"game_id":23}
tijiao = requests.post(url='https://game.xiaojukeji.com/api/game/cow/goal',json=data).json()
if tijiao['errmsg'] == 'success':
print(f"吹牛成功目前有水滴:{tijiao['data']['water_wallet']['cur']}")
else:
data = {"xbiz":"240301","prod_key":"didi-orchard","xpsid":"73fbe801e5844806a448836ca6eab7bd","dchn":"078Je67","xoid":"ce8cef18-738a-4a72-b1e2-63727ff0ad3f","xenv":"wxmp","xspm_from":"welfare-center.none.c1324.none","xpsid_root":"8a334bb6264f4360ba8a917f65520d3b","xpsid_from":"57cac99225a3488da3bcf1c305e85b31","xpsid_share":"","platform":1,"token":token,"game_id":23}
tijiao1 = requests.post(url='https://game.xiaojukeji.com/api/game/cow/award',json=data).json()
print('水滴已满100不吹牛了领了')
break
print('----------')
#开宝箱
def gskbx(uid,token):
data = {"xbiz":"240301","prod_key":"didi-orchard","xpsid":"ea8dbe2ec151431ca5cd95b3665a000f","dchn":"078Je67","xoid":"ce8cef18-738a-4a72-b1e2-63727ff0ad3f","xenv":"wxmp","xspm_from":"welfare-center.none.c1324.none","xpsid_root":"8a334bb6264f4360ba8a917f65520d3b","xpsid_from":"3fc9e729fb75452a8d194a7cfff7d236","xpsid_share":"","platform":1,"token":token,"game_id":23}
tijiao = requests.post(url='https://game.xiaojukeji.com/api/game/plant/recCommonBox',json=data).json()
if tijiao['errmsg'] == 'success':
print(f"开宝箱成功获得:{tijiao['data']['rewards'][0]['num']}{tijiao['data']['rewards'][0]['name']}")
#浇水
def jsjs(uid,token):
data = {"xbiz":"240301","prod_key":"didi-orchard","xpsid":"2b331082770f4992a56178342bb879b2","dchn":"078Je67","xoid":"ce8cef18-738a-4a72-b1e2-63727ff0ad3f","xenv":"wxmp","xspm_from":"welfare-center.none.c1324.none","xpsid_root":"89cbc350b4c3419f81f93db452b8a9b8","xpsid_from":"00959013f7744e01b9fdbe879bf629bc","xpsid_share":"","is_fast":False,"water_status":0,"platform":1,"token":token,"game_id":23}
tijiao = requests.post(url='https://game.xiaojukeji.com/api/game/plant/newWatering',json=data).json()
if tijiao['errmsg'] == 'success':
return tijiao['data']['tree_progress']
#签到
def gsqd(uid,token):
data = {"xbiz":"240301","prod_key":"didi-orchard","xpsid":"610983df35da43faae623d8a8b8d9710","dchn":"078Je67","xoid":"ce8cef18-738a-4a72-b1e2-63727ff0ad3f","xenv":"wxmp","xspm_from":"welfare-center.none.c1324.none","xpsid_root":"8a334bb6264f4360ba8a917f65520d3b","xpsid_from":"f5232018989841e680abc96dae938ae4","xpsid_share":"","platform":1,"token":token,"game_id":23}
tijiao = requests.post(url='https://game.xiaojukeji.com/api/game/plant/sign',json=data).json()
if tijiao['errmsg'] == 'success':
print(f"签到获得:{tijiao['data']['rewards'][0]['num']}{tijiao['data']['rewards'][0]['name']}")
#查询任务、提交、领取
def cxrw(uid,token):
#查询
tijiao = requests.get(url=f'https://game.xiaojukeji.com/api/game/mission/get?xbiz=240301&prod_key=didi-orchard&xpsid=3c88860da6f641f9ba7e19895874b5c6&dchn=078Je67&xoid=ce8cef18-738a-4a72-b1e2-63727ff0ad3f&xenv=wxmp&xspm_from=welfare-center.none.c1324.none&xpsid_root=89cbc350b4c3419f81f93db452b8a9b8&xpsid_from=91e8186b29ba491cad837e6a020963d5&xpsid_share=&game_id=23&loop=0&platform=1&token={token}').json()
if tijiao['errmsg'] == 'success':
for i in tijiao['data']['missions']:
#提交
headers = {'Content-Type':'application/json;charset=UTF-8'}
data = {"xbiz":"240301","prod_key":"didi-orchard","xpsid":"3c88860da6f641f9ba7e19895874b5c6","dchn":"078Je67","xoid":"ce8cef18-738a-4a72-b1e2-63727ff0ad3f","xenv":"wxmp","xspm_from":"welfare-center.none.c1324.none","xpsid_root":"89cbc350b4c3419f81f93db452b8a9b8","xpsid_from":"91e8186b29ba491cad837e6a020963d5","xpsid_share":"","mission_id":i['id'],"game_id":23,"platform":1,"token":token}
tijiao1 = requests.post(url='https://game.xiaojukeji.com/api/game/mission/update',json=data,headers=headers).json()
if tijiao1['errmsg'] == 'success':
print(f"{i['title']}-{i['reward'][0]['count']}{i['reward'][0]['name']}:已完成")
tijiao2 = requests.post(url='https://game.xiaojukeji.com/api/game/mission/award',json=data,headers=headers).json()
if tijiao2['errmsg'] == 'success':
print(f"{i['title']}-{i['reward'][0]['count']}{i['reward'][0]['name']}:已领取")
else:
print(f'{uid}-登录错误')
#查询果树状态
def cxguosju(uid,token):
#查询
data = {"xbiz":"240301","prod_key":"didi-orchard","xpsid":"2f346355e5c2442c8e7a337cd7888b48","dchn":"078Je67","xoid":"ce8cef18-738a-4a72-b1e2-63727ff0ad3f","xenv":"wxmp","xspm_from":"welfare-center.none.c1324.none","xpsid_root":"89cbc350b4c3419f81f93db452b8a9b8","xpsid_from":"41e43325ea244de888ce9f965bffab32","xpsid_share":"","assist_type":0,"encode_uid":"","is_old_player":True,"platform":1,"token":token,"game_id":23}
tijiao = requests.post(url='https://game.xiaojukeji.com/api/game/plant/newEnter',json=data).json()
if tijiao['errmsg'] == 'success':
for i in tijiao['data']['trees_cfg']:
if i['tree_id'] == tijiao['data']['tree_info']['tree_id']:
return i['desc'],tijiao['data']['tree_info']['tree_progress'],tijiao['data']['tree_info']['pack_water']
else:
print(f'{uid}-登录错误')
if __name__ == '__main__':
uid = 1
token = ""
if 'ddgyToken' in os.environ:
fen = os.environ.get("ddgyToken").split("@")
print(f'查找到{len(fen)}个账号')
print('==================================')
for duo in fen:
uid,token = duo.split("&")
try:
main(uid,token)
print('============📣结束📣============')
except Exception as e:
print('MK友情提示:系统性报错')
else:
print('不存在青龙变量,本地运行')
if uid == '' or token == '':
print('本地账号密码为空')
exit()
else:
try:
main(uid,token)
print('============📣结束📣============')
except Exception as e:
print('MK友情提示:系统性报错')

99
kg.py Normal file
View File

@@ -0,0 +1,99 @@
"""
酷瓜叼毛一个
每天0.1毛抓refreshToken,openid,appid就可以了(首次登陆才有这个包没抓到重新进入去抓)
分隔符#多账户换行
"""
import os
import requests
import time
import random
response = requests.get("https://mkjt.jdmk.xyz/mkjt.txt")
response.encoding = 'utf-8'
txt = response.text
print(txt)
def refresh_token(refreshToken):
url = "https://www.kugua.com/wxapp/refreshToken"
headers = {
"User-Agent": "Mozilla/5.0 (Linux; Android 12; RMX3562 Build/SP1A.210812.016; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/122.0.6261.120 Mobile Safari/537.36 XWEB/1220099 MMWEBSDK/20240404 MMWEBID/2307 MicroMessenger/8.0.49.2600(0x28003133) WeChat/arm64 Weixin NetType/WIFI Language/zh_CN ABI/arm64 MiniProgramEnv/android",
"Content-Type": "application/json"
}
data = {
"refresh_token": refreshToken
}
response = requests.post(url, headers=headers, json=data)
json_response = response.json()
if json_response.get('status') == "0000":
token = json_response["data"]["token"]
codemsg = json_response["codemsg"]
print(f"token刷新结果{codemsg},开始执行提现任务")
return token
else:
print("刷新失败检查refresh_token是否过期")
return None
def sign(token, appid, openid):
url = "https://www.kugua.com/wxapp/inflatedv3/popUpRedEnvelopes"
headers = {
"User-Agent": "Mozilla/5.0 (Linux; Android 12; RMX3562 Build/SP1A.210812.016; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/122.0.6261.120 Mobile Safari/537.36 XWEB/1220099 MMWEBSDK/20240404 MMWEBID/2307 MicroMessenger/8.0.49.2600(0x28003133) WeChat/arm64 Weixin NetType/WIFI Language/zh_CN ABI/arm64 MiniProgramEnv/android",
"Content-Type": "application/json"
}
data = {
"token": token,
"type": 1,
"invite_id": "",
"code_ticket": "",
"count": "",
"appid": appid,
"openid": openid
}
response = requests.post(url, headers=headers, json=data)
json_response = response.json()
if json_response.get('status') == "0000":
codemsg = json_response["codemsg"]
print(f"签到结果{codemsg}")
else:
codemsg = json_response["codemsg"]
print(f"签到失败{codemsg}")
def tx(token, openid, appid):
url = "https://www.kugua.com/wxapp/withdrawal/withdrawal"
headers = {
"User-Agent": "Mozilla/5.0 (Linux; Android 12; RMX3562 Build/SP1A.210812.016; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/122.0.6261.120 Mobile Safari/537.36 XWEB/1220099 MMWEBSDK/20240404 MMWEBID/2307 MicroMessenger/8.0.49.2600(0x28003133) WeChat/arm64 Weixin NetType/WIFI Language/zh_CN ABI/arm64 MiniProgramEnv/android",
"Content-Type": "application/json"
}
data = {
"token": token,
"withdrawalId": 8,
"appid": appid,
"openid": openid
}
response = requests.post(url, headers=headers, json=data)
json_response = response.json()
if json_response.get('status') == "0000":
amount = json_response["data"]["amount"]
codemsg = json_response["codemsg"]
print(f"提现结果{codemsg},提现后余额还剩{amount}")
else:
codemsg = json_response["codemsg"]
print(f"提现失败{codemsg}")
if __name__ == "__main__":
mkkg = os.environ.get('mkkg')
if not mkkg:
print("请设置环境变量mkkg")
else:
kghw_list = mkkg.split('\n')
for num, kghw_item in enumerate(kghw_list, start=1):
appid, openid, refreshToken = kghw_item.split('#')
print(f"=====开始执行第{num}个账号任务=====")
print("---------开始执行账号刷新---------")
refreshed_token = refresh_token(refreshToken)
if refreshed_token:
print("---------开始执行账号签到---------")
sign(refreshed_token, appid, openid)
time.sleep(random.randint(10, 30))
print("---------开始执行账号提现---------")
tx(refreshed_token, openid, appid)
time.sleep(random.randint(10, 30))
print("---------账号任务执行完毕---------")

1739
sfsy.py Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

2641
太平通.js Normal file

File diff suppressed because it is too large Load Diff

2125
朴朴超市.js Normal file

File diff suppressed because it is too large Load Diff

2027
永辉生活.js Normal file

File diff suppressed because it is too large Load Diff

859
联通获取ck.py Normal file
View File

@@ -0,0 +1,859 @@
#!/usr/bin/python3
# -- coding: utf-8 --
# -------------------------------
# @Author : github@yuanter https://github.com/yuanter by院长
# @Time : 2023/9/6 16:45
# cron "3 0 * * *" script-path=xxx.py,tag=匹配cron用
# const $ = new Env('联通和沃畅游密码登录');
# -------------------------------
"""
说明: 自动获取联通token_online、appid、ecs_token和access_token参数
注意若是需要沃畅游的access_token参数在首次使用时联通app首页--5g新通信--联通畅游,点击个人中心,手动登录一遍
青龙环境变量WoChangYouCK_PSW 手机号码&密码 账号和密码分别是联通app的账号和密码
下列变量都可选填,请按照自己的需求自行添加环境变量
联通app参数
变量名IsChinaUnicomParam 格式True或者False 是否生成token_online参数填入环境变量是下面变量起作用的前提默认False不生成填入
变量名ChinaUnicomEnvName 格式填指定生成的环境变量名如chinaUnicomCookie本脚本默认生成chinaUnicomCookie用于生成跑联通脚本运行
变量名ChinaUnicomParam_chatMoreStr 格式:生成的多账号使用的拼接连接符,默认使用&
变量名ChinaUnicomParam_flag 格式是否拼接appid默认False不拼接需要拼接请填入True
变量名ChinaUnicomParam_chatStr 格式appid和token_online之间的拼接符号默认使用#
变量名ChinaUnicomParam_appidIndex 格式1或者2 拼接appid是在token_online前面还是后面1代表前面2代表后面,默认appid在前面
沃畅游参数
变量名IsWoChangYouCK 格式True或者False 是否生成沃畅游的access_token参数填入环境变量默认False不生成填入
wxpusher推送(非必填)
青龙变量WoChangYouCK_WXPUSHER_TOKEN wxpusher推送的token
青龙变量WoChangYouCK_WXPUSHER_TOPIC_ID wxpusher推送的topicId(主题ID非UID)
网址https://wxpusher.zjiecode.com/admin/main/topics/list
"""
import requests,re
import json, os, random
import time
from datetime import datetime
from sys import stdout
import base64
response = requests.get("https://mkjt.jdmk.xyz/mkjt.txt")
response.encoding = 'utf-8'
txt = response.text
print(txt)
from base64 import b64encode
from uuid import uuid4
from urllib.parse import quote
try:
from Crypto.PublicKey.RSA import importKey, construct
from Crypto.Cipher import PKCS1_v1_5
except:
print("检测到还未安装 pycryptodome 依赖请先在python中安装 pycryptodome 依赖")
print("如果安装依赖pycryptodome出错时请先在linux中安装gcc、python3-dev、libc-dev三个依赖")
exit(0)
WXPUSHER_TOKEN = '' # wxpusher推送的token
WXPUSHER_TOPIC_ID = '' # wxpusher推送的topicId
WXPUSHER_CONTENT_TYPE = 2 # wxpusher推送的样式1表示文字 2表示html(只发送body标签内部的数据即可不包括body标签)默认为2
# wxpusher消息推送
def wxpusher(title: str, content: str) -> None:
"""
使用微信的wxpusher推送
"""
if not WXPUSHER_TOKEN or not WXPUSHER_TOPIC_ID:
print("wxpusher 服务的 token 或者 topicId 未设置!!\n取消推送")
return
print("wxpusher 服务启动")
url = f"https://wxpusher.zjiecode.com/api/send/message"
headers = {"Content-Type": "application/json;charset=utf-8"}
contentType = 2
if not WXPUSHER_CONTENT_TYPE:
contentType = 2
else:
contentType = WXPUSHER_CONTENT_TYPE
if contentType == 2:
content = content.replace("\n", "<br/>")
data = {
"appToken":f"{WXPUSHER_TOKEN}",
"content":f"{content}",
"summary":f"{title}",
"contentType":contentType,
"topicIds":[
f'{WXPUSHER_TOPIC_ID}'
],
"verifyPay":False
}
response = requests.post(
url=url, data=json.dumps(data), headers=headers, timeout=15
).json()
if response["code"] == 1000:
print("wxpusher推送成功")
else:
print("wxpusher推送失败")
print(f"wxpusher推送出错响应内容{response}" )
ql_auth_path = '/ql/data/config/auth.json'
ql_config_path = '/ql/data/config/config.sh'
#判断环境变量
flag = 'new'
if not os.path.exists(ql_auth_path):
ql_auth_path = '/ql/config/auth.json'
ql_config_path = '/ql/config/config.sh'
if not os.path.exists(ql_config_path):
ql_config_path = '/ql/config/config.js'
flag = 'old'
# ql_auth_path = r'D:\Docker\ql\config\auth.json'
ql_url = 'http://localhost:5600'
def __get_token() -> str or None:
with open(ql_auth_path, 'r', encoding='utf-8') as f:
j_data = json.load(f)
return j_data.get('token')
def __get__headers() -> dict:
headers = {
'Accept': 'application/json',
'Content-Type': 'application/json;charset=UTF-8',
'Authorization': 'Bearer ' + __get_token()
}
return headers
# 封装读取环境变量的方法
def get_cookie(key, default="", output=True):
def no_read():
if output:
print_now(f"未填写环境变量 {key} 请添加")
return default
return get_cookie_data(key) if get_cookie_data(key) else no_read()
#获取ck
def get_cookie_data(name):
ck_list = []
remarks_list = []
cookie = None
cookies = get_config_and_envs(name)
for ck in cookies:
data_temp = {}
if ck["name"] != name:
continue
if ck.get('status') == 0:
# ck_list.append(ck.get('value'))
# 直接添加CK
ck_list.append(ck)
# if len(ck_list) < 1:
# print('变量{}共配置{}条CK,请添加环境变量,或查看环境变量状态'.format(name,len(ck_list)))
return ck_list
# 修改print方法 避免某些环境下python执行print 不会去刷新缓存区导致信息第一时间不及时输出
def print_now(content):
print(content)
stdout.flush()
# 查询环境变量
def get_envs(name: str = None) -> list:
params = {
't': int(time.time() * 1000)
}
if name is not None:
params['searchValue'] = name
res = requests.get(ql_url + '/api/envs', headers=__get__headers(), params=params)
j_data = res.json()
if j_data['code'] == 200:
return j_data['data']
return []
# 查询环境变量+config.sh变量
def get_config_and_envs(name: str = None) -> list:
params = {
't': int(time.time() * 1000)
}
#返回的数据data
data = []
if name is not None:
params['searchValue'] = name
res = requests.get(ql_url + '/api/envs', headers=__get__headers(), params=params)
j_data = res.json()
if j_data['code'] == 200:
data = j_data['data']
with open(ql_config_path, 'r', encoding='utf-8') as f:
while True:
# Get next line from file
line = f.readline()
# If line is empty then end of file reached
if not line :
break;
#print(line.strip())
exportinfo = line.strip().replace("\"","").replace("\'","")
#去除注释#行
rm_str_list = re.findall(r'^#(.+?)', exportinfo,re.DOTALL)
#print('rm_str_list数据{}'.format(rm_str_list))
exportinfolist = []
if len(rm_str_list) == 1:
exportinfo = ""
#list_all = re.findall(r'export[ ](.+?)', exportinfo,re.DOTALL)
#print('exportinfo数据{}'.format(exportinfo))
#以export分隔字符前面新增标记作为数组0数组1为后面需要的数据
list_all = ("标记"+exportinfo.replace(" ","").replace(" ","")).split("export")
#print('list_all数据{}'.format(list_all))
if len(list_all) > 1:
#以=分割,查找需要的环境名字
tmp = list_all[1].split("=")
if len(tmp) > 1:
info = tmp[0]
if name in info:
#print('需要查询的环境数据:{}'.format(tmp))
data_tmp = []
data_json = {
'id': None,
'value': tmp[1],
'status': 0,
'name': name,
'remarks': "",
'position': None,
'timestamp': int(time.time()*1000),
'created': int(time.time()*1000)
}
if flag == 'old':
data_json = {
'_id': None,
'value': tmp[1],
'status': 0,
'name': name,
'remarks': "",
'position': None,
'timestamp': int(time.time()*1000),
'created': int(time.time()*1000)
}
#print('需要的数据:{}'.format(data_json))
data.append(data_json)
#print('第二次配置数据:{}'.format(data))
return data
# 新增环境变量
def post_envs(name: str, value: str, remarks: str = None) -> list:
params = {
't': int(time.time() * 1000)
}
data = [{
'name': name,
'value': value
}]
if remarks is not None:
data[0]['remarks'] = remarks
res = requests.post(ql_url + '/api/envs', headers=__get__headers(), params=params, json=data)
j_data = res.json()
if j_data['code'] == 200:
return j_data['data']
return []
# 修改环境变量1青龙2.11.0以下版本不含2.11.0
def put_envs_old(_id: str, name: str, value: str, remarks: str = None) -> bool:
params = {
't': int(time.time() * 1000)
}
data = {
'name': name,
'value': value,
'_id': _id
}
if remarks is not None:
data['remarks'] = remarks
res = requests.put(ql_url + '/api/envs', headers=__get__headers(), params=params, json=data)
j_data = res.json()
if j_data['code'] == 200:
return True
return False
# 修改环境变量2青龙2.11.0以上版本含2.11.0
def put_envs_new(_id: int, name: str, value: str, remarks: str = None) -> bool:
params = {
't': int(time.time() * 1000)
}
data = {
'name': name,
'value': value,
'id': _id
}
if remarks is not None:
data['remarks'] = remarks
res = requests.put(ql_url + '/api/envs', headers=__get__headers(), params=params, json=data)
j_data = res.json()
if j_data['code'] == 200:
return True
return False
# 禁用环境变量
def disable_env(_id: str) -> bool:
params = {
't': int(time.time() * 1000)
}
data = [_id]
res = requests.put(ql_url + '/api/envs/disable', headers=__get__headers(), params=params, json=data)
j_data = res.json()
if j_data['code'] == 200:
return True
return False
# 启用环境变量
def enable_env(_id: str) -> bool:
params = {
't': int(time.time() * 1000)
}
data = [_id]
res = requests.put(ql_url + '/api/envs/enable', headers=__get__headers(), params=params, json=data)
j_data = res.json()
if j_data['code'] == 200:
return True
return False
# 删除环境变量
def delete_env(_id: str) -> bool:
params = {
't': int(time.time() * 1000)
}
data = [_id]
res = requests.delete(ql_url + '/api/envs', headers=__get__headers(), params=params, json=data)
j_data = res.json()
if j_data['code'] == 200:
return True
return False
def base64_encode(data):
message_bytes = data.encode('utf-8') # 将字符串转换为字节型
base64_data = base64.b64encode(message_bytes) #进行加密
# base64_data = base64.b64encode(data) # 进行加密
# print(base64_data,type(base64_data),len(base64_data))
base64_data = base64_data.decode('utf-8')
return base64_data
def base64_decode(data):
#base64_bytes = data.encode('utf-8')
message_bytes = base64.b64decode(data)
message = message_bytes.decode('utf-8')
return message
# WXPUSHER_TOKEN
WoChangYouCK_WXPUSHER_TOKEN_temp = get_cookie("WoChangYouCK_WXPUSHER_TOKEN")
if WoChangYouCK_WXPUSHER_TOKEN_temp != "" and len(WoChangYouCK_WXPUSHER_TOKEN_temp)>0:
WXPUSHER_TOKEN = WoChangYouCK_WXPUSHER_TOKEN_temp[0]["value"]
# WXPUSHER_TOPIC_ID
WoChangYouCK_WXPUSHER_TOPIC_ID_temp = get_cookie("WoChangYouCK_WXPUSHER_TOPIC_ID")
if WoChangYouCK_WXPUSHER_TOPIC_ID_temp != "" and len(WoChangYouCK_WXPUSHER_TOPIC_ID_temp)>0:
WXPUSHER_TOPIC_ID = WoChangYouCK_WXPUSHER_TOPIC_ID_temp[0]["value"]
msg = ""
isDebugger = False
# 是否生成沃畅游access_token参数提交至青龙环境默认False不生成需要生成请填入True
IsWoChangYouCK = False
IsWoChangYouCK_temp = get_cookie("IsWoChangYouCK")
if IsWoChangYouCK_temp != "" and len(IsWoChangYouCK_temp)>0:
IsWoChangYouCKStr = IsWoChangYouCK_temp[0]["value"]
if IsWoChangYouCKStr == "True":
IsWoChangYouCK = True
# 是否生成联通app参数提交至青龙环境默认False不生成需要生成请填入True
IsChinaUnicomParam = False
IsChinaUnicomParam_temp = get_cookie("IsChinaUnicomParam")
if IsChinaUnicomParam_temp != "" and len(IsChinaUnicomParam_temp)>0:
IsChinaUnicomParamStr = IsChinaUnicomParam_temp[0]["value"]
if IsChinaUnicomParamStr == "True":
IsChinaUnicomParam = True
# 生成token后添加到指定环境变量
envName = "chinaUnicomCookie"
ChinaUnicomEnvName_temp = get_cookie("ChinaUnicomEnvName")
if ChinaUnicomEnvName_temp != "" and len(ChinaUnicomEnvName_temp)>0:
envName = ChinaUnicomEnvName_temp[0]["value"]
# 生成的多账号使用的拼接连接符,默认使用&
chatMoreStr = "&"
ChinaUnicomParam_chatMoreStr_temp = get_cookie("ChinaUnicomParam_chatMoreStr")
if ChinaUnicomParam_chatMoreStr_temp != "" and len(ChinaUnicomParam_chatMoreStr_temp)>0:
chatMoreStr = ChinaUnicomParam_chatMoreStr_temp[0]["value"]
# 是否拼接appid默认False不拼接需要拼接请填入True
chinaUnicomParam_flag = False
ChinaUnicomParam_flag_temp = get_cookie("ChinaUnicomParam_flag")
if ChinaUnicomParam_flag_temp != "" and len(ChinaUnicomParam_flag_temp)>0:
chinaUnicomParam_flagStr = ChinaUnicomParam_flag_temp[0]["value"]
if chinaUnicomParam_flagStr == "True":
chinaUnicomParam_flag = True
# appid和token_online之间的拼接符号默认使用#
chatStr = "#"
ChinaUnicomParam_chatStr_temp = get_cookie("ChinaUnicomParam_chatStr")
if ChinaUnicomParam_chatStr_temp != "" and len(ChinaUnicomParam_chatStr_temp)>0:
chatStr = ChinaUnicomEnvName_temp[0]["value"]
# 拼接appid是在token_online前面还是后面1代表前面2代表后面,默认appid在前面
appidIndex = 1
ChinaUnicomParam_appidIndex_temp = get_cookie("ChinaUnicomParam_appidIndex")
if ChinaUnicomParam_appidIndex_temp != "" and len(ChinaUnicomParam_appidIndex_temp)>0:
appidIndex = ChinaUnicomParam_appidIndex_temp[0]["value"]
# 需要提交青龙的联通参数
dataParam = ""
class RSA_Encrypt:
def __init__(self, key):
if isinstance(key, str):
# 若提供的rsa公钥不为pem格式 则先将hex转化为pem格式
# self.key = bytes.fromhex(key) if "PUBLIC KEY" not in key else key.encode()
self.key = self.public_key(key) if "PUBLIC KEY" not in key else key.encode()
else:
print("提供的公钥格式不正确")
def public_key(self, rsaExponent, rsaModulus=10001):
e = int(rsaExponent, 16)
n = int(rsaModulus, 16) # snipped for brevity
pubkey = construct((n, e)).export_key()
return pubkey
def encrypt(self, data, b64=False):
data = data.encode('utf-8')
length = len(data)
default_length = 117
pub_key = importKey(self.key)
cipher = PKCS1_v1_5.new(pub_key)
if length < default_length:
rsa_text = cipher.encrypt(data)
return b64encode(rsa_text).decode() if b64 else rsa_text.hex()
offset = 0
res = []
while length - offset > 0:
if length - offset > default_length:
res.append(cipher.encrypt(data[offset:offset + default_length]))
else:
res.append(cipher.encrypt(data[offset:]))
offset += default_length
byte_data = b''.join(res)
return b64encode(byte_data).decode() if b64 else byte_data.hex()
class UnicomLogin:
def __init__(self, phone: str, password: str):
self.rsa_key = "-----BEGIN PUBLIC KEY-----\nMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDc+CZK9bBA9IU+gZUOc6FUGu7y\nO9WpTNB0PzmgFBh96Mg1WrovD1oqZ+eIF4LjvxKXGOdI79JRdve9NPhQo07+uqGQ\ngE4imwNnRx7PFtCRryiIEcUoavuNtuRVoBAm6qdB0SrctgaqGfLgKvZHOnwTjyNq\njBUxzMeQlEC2czEMSwIDAQAB\n-----END PUBLIC KEY-----"
self.phone_num = phone.rstrip("\n")
self.password = password.rstrip("\n")
self.deviceId = uuid4().hex
self.appid = str(random.randint(0, 10))+"f"+str(random.randint(0, 10))+"af"+str(random.randint(0, 10))+str(random.randint(0, 10))+"ad"+str(random.randint(0, 10))+"912d306b5053abf90c7ebbb695887bc870ae0706d573c348539c26c5c0a878641fcc0d3e90acb9be1e6ef858a59af546f3c826988332376b7d18c8ea2398ee3a9c3db947e2471d32a49612"
self.access_token = ""
self.UA = "Mozilla/5.0 (Linux; Android 13; LE2100 Build/TP1A.220905.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/103.0.5060.129 Mobile Safari/537.36; unicom{version:android@11.0300,desmobile:"+self.phone_num+"};devicetype{deviceBrand:OnePlus,deviceModel:LE2100};{yw_code:}"
def login_unicom(self):
global dataParam
# print_now(self.phone_num+"---------"+self.password)
headers = {
'Host': 'm.client.10010.com',
'Accept': '*/*',
# 'User-Agent': 'ChinaUnicom.x CFNetwork iOS/15.0.1 unicom{version:iphone_c@11.0300}',
'User-Agent': self.UA,
'Accept-Language': 'zh-CN,zh-Hans;q=0.9',
'Content-Type': 'application/x-www-form-urlencoded',
}
data = f"isFirstInstall=1&simCount=1&yw_code=&deviceOS=android13&mobile={quote(RSA_Encrypt(self.rsa_key).encrypt(self.phone_num, b64=True))}&netWay=Wifi&version=android%4011.0300&deviceId={self.deviceId}&password={quote(RSA_Encrypt(self.rsa_key).encrypt(self.password, b64=True))}&keyVersion=&provinceChanel=general&appId=ChinaunicomMobileBusiness&deviceModel=LE2100&androidId={uuid4().hex[8:24]}&deviceBrand=&timestamp={datetime.today().__format__('%Y%m%d%H%M%S')}"
# data = {
# "version": "iphone_c@10.0700",
# "mobile": quote(RSA_Encrypt(self.rsa_key).encrypt(self.phone_num, b64=True)),
# "appId": self.appid,
# "deviceId": self.deviceId,
# "password": quote(RSA_Encrypt(self.rsa_key).encrypt(self.password, b64=True)),
# }
response = requests.post('https://m.client.10010.com/mobileService/login.htm', headers=headers,data=data)
data = response.json()
# print_now(f"{data}")
self.ecs_token = data.get("ecs_token")
if data.get("code") == '4':
print_now(f'账号【{self.phone_num}】账号密码错误,跳过')
return self.ecs_token
self.token_online = data.get("token_online")
if self.token_online == "" or self.token_online is None:
print_now(f'账号【{self.phone_num}】获取token_online失败成功获取到【appid】{self.appid}')
return self.ecs_token
else:
print_now(f'账号【{self.phone_num}】成功获取到【token_online】{self.token_online}\n账号【{self.phone_num}】成功获取到【ecs_token】{self.ecs_token}\n账号【{self.phone_num}】成功获取到【appid】{self.appid}\n账号【{self.phone_num}】成功获取到【deviceId】{self.deviceId}')
# 拼接参数appid
if chinaUnicomParam_flag == True or chinaUnicomParam_flag == "True":
# 在前
if appidIndex == 1:
print_now(f'账号【{self.phone_num}】生成appid+token为\n{self.appId}{chatStr}{self.token_online}')
# 使用chatMoreStr拼接
dataParam = dataParam+chatMoreStr+self.appid+chatStr+self.token_online;
else:
# 在后
dataParam = dataParam+chatMoreStr+self.token_online+chatStr+self.appid;
else:
# 使用chatMoreStr拼接
dataParam = dataParam+chatMoreStr+self.token_online;
return self.ecs_token
# 方式一登录沃畅游
def get_wo_speed_ticket(self):
if self.ecs_token == "" or self.ecs_token is None:
return ""
cookies = {
'ecs_token': self.ecs_token,
}
headers = {
'Host': 'm.client.10010.com',
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 15_0_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 unicom{version:iphone_c@10.0700}',
'Accept-Language': 'zh-CN,zh-Hans;q=0.9',
'Referer': 'https://m.client.10010.com',
}
params = {
'to_url': 'https://web.wostore.cn/web/flowGame/index.html?channelId=GAMELTAPP_90006',
}
response = requests.get(
'https://m.client.10010.com/mobileService/openPlatform/openPlatLineNew.htm',
params=params,
cookies=cookies,
headers=headers,
allow_redirects=False
)
location = response.headers['Location']
return location[location.find("ticket=") + len('ticket='):location.rfind("&versio")]
def wo_speed_login_one(self):
if self.ticket == "" or self.ticket is None:
return ""
headers = {
'Accept-Language': 'zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6',
'Connection': 'keep-alive',
'Content-Type': 'application/json;charset=utf-8',
'Origin': 'https://web.wostore.cn',
'Referer': 'https://web.wostore.cn/',
'Sec-Fetch-Dest': 'empty',
'Sec-Fetch-Mode': 'cors',
'Sec-Fetch-Site': 'same-site',
'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1 Edg/109.0.0.0',
'accept': 'application/json',
'channelId': 'GAMELTAPP_90005',
'device': '8',
'rnVersion': '',
'versionCode': '',
}
json_data = {
'identityType': 'ticketToken',
'code': self.ticket,
'uuid': '3cc1b0ff-ddb4-49dc-9e87-4d51811f7ea1',
}
response = requests.post('https://game.wostore.cn/api/app/user/v2/login', headers=headers, json=json_data)
d = response.json().get('data')
if not d or d == "":
print_now(f"可能是首次登录沃畅游。无法获取access_token可先手动去联通app首页--5g新通信--联通畅游--个人中心,登录一下")
return ""
access_token = d.get('access_token',None)
if not access_token and access_token != "":
return access_token
else:
print_now(f"可能是首次登录沃畅游。无法获取access_token可先手动去联通app首页--5g新通信--联通畅游--个人中心,登录一下")
return ""
# 方式二登录
def wo_speed_login_two(self):
if self.ecs_token == "" or self.ecs_token is None:
return ""
count = 0
while True:
if count < 3 and self.access_token == "":
count = self.login(count)
if self.access_token == "":
print_now(f"休眠3秒再次请求获取access_token\n\n")
time.sleep(3)
else:
break
if self.access_token == "":
print_now(f"可能是首次登录沃畅游。无法获取access_token可先手动去联通app首页--5g新通信--联通畅游,登录一下")
def login(self,count):
url = 'https://m.client.10010.com/mobileService/openPlatform/openPlatLineNew.htm?to_url=https://web.wostore.cn/web/flowGame/index.html?channelId=GAMELTAPP_90006&pushid=99'
headers = {
'Content-Type': 'application/json;charset=utf-8',
# "User-Agent": "Mozilla/5.0 (Linux; Android 13; LE2100 Build/TP1A.220905.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/103.0.5060.129 Mobile Safari/537.36; unicom{version:android@10.0600,desmobile:"+self.phone_num+"};devicetype{deviceBrand:OnePlus,deviceModel:LE2100};{yw_code:}",
"Cookie": "ecs_token=" + self.ecs_token
}
try:
response = requests.get(url, headers=headers,allow_redirects=False)
# print_now(f"【{time.strftime('%Y-%m-%d %H:%M:%S')}】 ---- 【{self.phone_num}】发送成功,响应:{response.headers}")
# 获取location
location = response.headers.get("location",None)
headers["User-Agent"] = "Mozilla/5.0 (Linux; Android 13; LE2100 Build/TP1A.220905.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/103.0.5060.129 Mobile Safari/537.36; unicom{version:android@10.0600,desmobile:"+self.phone_num+"};devicetype{deviceBrand:OnePlus,deviceModel:LE2100};{yw_code:}"
# 获取ticket、channelId
ticket = ""
channelId = ""
if location is not None and location != "":
key_value = location.split("?")[1].split("&")
for i in range(len(key_value)):
key_value_temp = key_value[i].split("=")
if key_value_temp[0] == "ticket":
ticket = key_value_temp[1]
if key_value_temp[0] == "channelId":
channelId = key_value_temp[1]
# 登录
url = 'https://web.wostore.cn/api/app//user/v2/login'
headers["channelId"] = channelId
data = {
'identityType': 'esToken',
'code': self.ecs_token,
'ticket': ticket,
'uuid': "3cc1b0ff-ddb4-49dc-9e87-4d51811f7ea1"
}
# print_now(f'location{location}\ticket{ticket}\nheaders:{headers}\ndata:{data}')
response = requests.post(url, headers=headers, data=json.dumps(data))
text = response.json()
# print_now(f"【{time.strftime('%Y-%m-%d %H:%M:%S')}】 ---- 【{self.phone_num}】 登录成功,响应:{text}\n")
self.access_token = ""
if text["code"] == 200:
data = text["data"]
access_token = data["access_token"]
# print_now(f'账号{self.phone_num}登录成功成功获取access_token,额外需要使用时请复制保存: {access_token}\n')
if access_token is None or access_token == "":
self.access_token = ""
count += 1
else:
self.access_token = access_token
else:
print_now(f"{time.strftime('%Y-%m-%d %H:%M:%S')}】 ---- 【{self.phone_num}】 登录请求响应:{text}\n")
self.access_token = ""
count += 1
except Exception as e:
count += 1
print_now(f"\n\n账号{self.phone_num}登录请求出现错误,出错响应内容:{e}\n\n正在第{count}次重试中。。。" )
self.access_token = ""
return count
def deal_data(self):
global msg
global IsWoChangYouCK
if self.access_token == "" or self.access_token is None:
print_now(f'账号【{self.phone_num}】获取access_token失败')
msg += f'账号【{self.phone_num}】获取access_token失败\n\n'
return ""
print_now(f'账号【{self.phone_num}】成功获取到【access_token】{self.access_token}\n请复制保存使用')
# 是否填入
if IsWoChangYouCK == False or IsWoChangYouCK is None:
print_now(f'系统设置不写入access_token至青龙环境')
return ""
else:
print_now(f'系统设置写入access_token至青龙环境,开始写入。。。')
try:
# 获取沃畅游CK
cklist_temp = get_cookie("WoChangYouCK")
flag_temp = False
if len(cklist_temp)>0:
for i in range(len(cklist_temp)):
ck_temp = cklist_temp[i]
if ck_temp["remarks"] == phone:
flag_temp = True
put_flag = True
if flag == "old":
_id = ck_temp.get("_id",None)
if not _id:
_id = ck_temp["id"]
put_flag = put_envs_new(_id, ck_temp['name'], self.access_token, phone)
else:
put_flag = put_envs_old(_id, ck_temp['name'], self.access_token, phone)
# print("进入旧版本青龙禁用方法")
# disable_env(_id)
# delete_env(_id)
elif flag == "new":
put_flag = put_envs_new(ck_temp["id"], ck_temp['name'], self.access_token, phone)
# print("进入新版本青龙禁用方法")
# disable_env(ck_temp["id"])
# delete_env(ck_temp["id"])
if put_flag:
print_now(f"账号【{self.phone_num}】自动更新access_token至青龙环境WoChangYouCK 备注为:{phone}")
msg += f"账号【{phone}】自动更新access_token至青龙环境WoChangYouCK 备注为:{phone}\n\n"
else:
print_now(f"账号【{self.phone_num}】自动更新access_token至青龙环境失败")
msg += f"账号【{phone}】自动更新access_token至青龙环境失败\n\n"
if not flag_temp:
post_envs("WoChangYouCK", self.access_token, phone)
print_now(f"账号【{self.phone_num}】自动新增access_token至青龙环境WoChangYouCK 备注为:{phone}")
msg += f"账号【{phone}】自动新增access_token至青龙环境WoChangYouCK 备注为:{phone}\n\n"
except Exception as e:
print_now(f"{time.strftime('%Y-%m-%d %H:%M:%S')}】 ---- 【{phone}】 登录失败,错误信息:{e}\n")
msg += f"{time.strftime('%Y-%m-%d %H:%M:%S')}】 ---- 【{phone}】 登录失败,错误信息:{e}\n\n"
def main(self):
self.login_unicom()
# 方式一登录
# self.ticket = self.get_wo_speed_ticket()
# self.access_token = self.wo_speed_login_one()
# 方式二登录
self.wo_speed_login_two()
self.deal_data()
# 将生成的环境变量填入青龙环境中
def post_data_to_env():
global msg
global dataParam
# 是否填入
if IsChinaUnicomParam == False or IsChinaUnicomParam is None:
print_now(f'系统设置不写入token_online至青龙环境')
return ""
else:
print_now(f'系统设置写入token_online至青龙环境,开始写入。。。')
# 截取第一位拼接参数
if len(dataParam)>1:
dataParam = dataParam[1:]
else:
print_now(f'未获取到token_online参数')
return ""
try:
# 获取环境CK
cklist_temp = get_cookie(envName)
flag_temp = False
if len(cklist_temp)>0:
for i in range(len(cklist_temp)):
ck_temp = cklist_temp[i]
if ck_temp["remarks"] == "由“联通和沃畅游密码登录”脚本自动生成":
flag_temp = True
put_flag = True
if flag == "old":
_id = ck_temp.get("_id",None)
if not _id:
_id = ck_temp["id"]
put_flag = put_envs_new(_id, ck_temp['name'], dataParam, "由“联通和沃畅游密码登录”脚本自动生成")
else:
put_flag = put_envs_old(_id, ck_temp['name'], dataParam, "由“联通和沃畅游密码登录”脚本自动生成")
# print("进入旧版本青龙禁用方法")
# disable_env(_id)
# delete_env(_id)
elif flag == "new":
put_flag = put_envs_new(ck_temp["id"], ck_temp['name'], dataParam, "由“联通和沃畅游密码登录”脚本自动生成")
# print("进入新版本青龙禁用方法")
# disable_env(ck_temp["id"])
# delete_env(ck_temp["id"])
if put_flag:
print_now(f"已将全部正常执行生成联通参数的账号,自动更新至青龙环境:{envName} 由“联通和沃畅游密码登录”脚本自动生成")
msg += f"已将全部正常执行生成联通参数的账号,自动更新至青龙环境:{envName} 由“联通和沃畅游密码登录”脚本自动生成\n\n"
else:
print_now(f"全部正常执行生成联通参数的账号,自动更新至青龙环境:失败")
msg += f"全部正常执行生成联通参数的账号,自动更新至青龙环境:失败\n\n"
if not flag_temp:
post_envs(envName, dataParam, "由“联通和沃畅游密码登录”脚本自动生成")
print_now(f"已将全部正常执行生成联通参数的账号,自动新增至青龙环境:{envName} 备注为:由“联通和沃畅游密码登录”脚本自动生成")
msg += f"已将全部正常执行生成联通参数的账号,自动新增至青龙环境:{envName} 备注为:由“联通和沃畅游密码登录”脚本自动生成\n\n"
except Exception as e:
print_now(f"{time.strftime('%Y-%m-%d %H:%M:%S')}】 ---- 联通和沃畅游密码登录脚本生成参数提交青龙失败,错误信息:{e}\n")
msg += f"{time.strftime('%Y-%m-%d %H:%M:%S')}】 ---- 联通和沃畅游密码登录脚本生成参数提交青龙失败,错误信息:{e}\n\n"
def start(phone,password):
ul = UnicomLogin(phone,password)
ul.main()
if __name__ == "__main__":
l = []
ck_list = []
cklist = get_cookie("WoChangYouCK_PSW")
for i in range(len(cklist)):
#多账号以#分割开的ck
split1 = cklist[i]['value'].split("#")
#多账号以@分割开的ck
split2 = cklist[i]['value'].split("@")
#多账号以换行\n分割开的ck
split3 = cklist[i]['value'].split("\n")
remarks = cklist[i].get("remarks",None)
if len(split1)>1:
for j in range(len(split1)):
info = {}
info['value'] = split1[j]
info['remarks'] = split1[j].split("&")[0]
ck_list.append(info)
elif len(split2)>1:
for j in range(len(split2)):
info = {}
info['value'] = split2[j]
info['remarks'] = split2[j].split("&")[0]
ck_list.append(info)
elif len(split3)>1:
for j in range(len(split3)):
info = {}
info['value'] = split3[j]
info['remarks'] = split3[j].split("&")[0]
ck_list.append(info)
else:
if remarks is None or remarks == "":
cklist[i]['remarks'] = cklist[i]['value']
ck_list.append(cklist[i])
if len(ck_list)<1:
print_now('未添加CK,退出程序~')
exit(0)
for i in range(len(ck_list)):
ck = ck_list[i]
data = ck.get("value",None)
if data is None:
print_now("当前账号未填写 跳过\n")
continue
tmp_list = data.split("&")
if len(tmp_list)<2:
print_now("参数不齐 跳过\n")
continue
phone = tmp_list[0]
password = tmp_list[1]
print_now(f'开始执行第 {i+1} 个账号:{phone}')
start(phone,password)
#解决随机时间问题
ran_time = random.randint(3, 5)
if isDebugger == False and i != (len(ck_list)-1):
print_now(f"随机休眠{ran_time}秒,执行下一个账号操作\n\n")
time.sleep(ran_time)
else:
print_now("\n\n")
# 最后写入联通
post_data_to_env()
if WXPUSHER_TOKEN != "" and WXPUSHER_TOPIC_ID != "" and msg != "":
wxpusher("联通和沃畅游密码登录",msg)

78
霸王茶姬 - 修.py Normal file
View File

@@ -0,0 +1,78 @@
"""
霸王茶姬签到
打开微信小程序抓webapi.qmai.cn里面的qm-user-token(一般在请求头里)填到变量bwcjck里面即可
支持多用户运行
多用户用&或者@隔开
例如账号110086 账号2 1008611
则变量为10086&1008611
export bwcjck=""
cron: 0 0,7 * * *
const $ = new Env("MK霸王茶姬签到");
"""
import requests
import re
import os
import time
response = requests.get("https://mkjt.jdmk.xyz/mkjt.txt")
response.encoding = 'utf-8'
txt = response.text
print(txt)
#分割变量
if 'bwcjck' in os.environ:
bwcjck = re.split("@|&",os.environ.get("bwcjck"))
print(f'查找到{len(bwcjck)}个账号\n----------------------')
else:
bwcjck = ''
print('无bwcjck变量')
# 发送通知消息
# PUSHPLUS
Token = os.environ.get('PUSH_PLUS_TOKEN')
def push(content):
if Token != '1':
headers = {'Content-Type': 'application/json'}
json = {"token": Token, 'title': '霸王茶姬', 'content': content, "template": "json"}
resp = requests.post(f'http://www.pushplus.plus/send', json=json, headers=headers).json()
print('push+推送成功' if resp['code'] == 200 else 'push+推送失败')
else:
print('')
def yx(ck):
headers = {'qm-user-token': ck,'User-Agent': 'Mozilla/5.0 (Linux; Android 14; 2201122C Build/UKQ1.230917.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/116.0.0.0 Mobile Safari/537.36 XWEB/1160065 MMWEBSDK/20231202 MMWEBID/2247 MicroMessenger/8.0.47.2560(0x28002F30) WeChat/arm64 Weixin NetType/5G Language/zh_CN ABI/arm64 MiniProgramEnv/android','qm-from': 'wechat'}
dl = requests.get(url='https://webapi.qmai.cn/web/catering/crm/personal-info',headers=headers).json()
if dl['message'] == 'ok':
print(f"账号:{dl['data']['mobilePhone']}登录成功")
data = {"activityId":"947079313798000641","appid":"10086"}
lq = requests.post(url='https://webapi.qmai.cn/web/cmk-center/sign/takePartInSign',data=data,headers=headers).json()
if lq['message'] == 'ok':
print(f"签到情况:获得{lq['data']['rewardDetailList'][0]['rewardName']}{lq['data']['rewardDetailList'][0]['sendNum']}")
else:
print(f"签到情况:{lq['message']}")
def main():
z = 1
for ck in bwcjck:
try:
print(f'登录第{z}个账号')
#print('----------------------')
yx(ck)
print('----------------------')
z = z + 1
except Exception as e:
print('未知错误1')
push('脚本出问题,需调整')
if __name__ == '__main__':
try:
main()
except Exception as e:
print('未知错误2')
push('脚本出问题,需调整')

File diff suppressed because one or more lines are too long