昨天有位老哥需要多用户的脚本,动手改了下,今天有位老哥又更新了下脚本,不需要抓包cookie参数,只需要抓包这个请求就行http://pay.zk2016.com/api/web/getwealth.do。
#变量zzdwc
PlaceID#WechatId#PublicOpenID#CustID;
多个用户变量名称一样,只需在每个变量结尾添加;即可
代码如下:
#变量zzdwc 不在需要添加cookie 但结尾需要加上;
#ck填写PlaceID#WechatId#PublicOpenID#CustID;
import os
import json
import requests
def sign(params):
if params is None:
print("环境变量zzdwc未设置")
else:
params = params.split('#')
if len(params) != 4:
print("环境变量zzdwc格式错误")
else:
CustID = params[3]
if ";" in CustID:
CustID = params[3][0:-1]
else:
pass
PublicOpenID = params[2]
WechatId = params[1]
PlaceID = params[0]
user_dic = {}
url1 = "http://pay.zk2016.com/api/web/getwealth.do"
headers1 = {"Host": "pay.zk2016.com", "Content-Length": "138"}
data1 = {"PlaceID": PlaceID, "WechatId": WechatId, "PublicOpenID": PublicOpenID}
response1 = requests.post(url1, headers=headers1, data=json.dumps(data1))
cookies = response1.cookies.get_dict()
cookies_str = ','.join([f'{key}={value}' for key, value in cookies.items()])
response_data1 = response1.json()
cookie = "serveropenid_215ab968-3797-e911-85df-d7af90092ad6=" + WechatId + ";" + "branchopenid_wxc89501e85bc2b259_215ab968-3797-e911-85df-d7af90092ad6=" + PublicOpenID + "; BranchID=215ab968-3797-e911-85df-d7af90092ad6; PublicPlaceID215ab968-3797-e911-85df-d7af90092ad6=c4bf4cdd-a5f3-4e0d-926f-7f67e2042cc7; placeName215ab968-3797-e911-85df-d7af90092ad6=%u90D1%u5DDE%u57CE%u5E02%u82F1%u96C4%u65E0%u9650%u57CE%u5E97;" + cookies_str
username = response_data1.get('userinfo', {}).get('SecondName')
print('用户名:', username)
wealthlist = response_data1.get('wealthlist', [])
wealth_before_sign = ''
for item in wealthlist:
if item.get('name') == '存币':
wealth_before_sign = item.get('num')
print('当前存币:', wealth_before_sign)
url2 = "http://pay.zk2016.com/web/signin.do?PlaceID=" + PlaceID
headers2 = {
"Host": "pay.zk2016.com",
"Connection": "keep-alive",
"Upgrade-Insecure-Requests": "1",
"User-Agent": "Mozilla/5.0 (Linux; Android 12; M2007J17C Build/SKQ1.211006.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/111.0.5563.116 Mobile Safari/537.36 XWEB/5317 MMWEBSDK/20230805 MMWEBID/3914 MicroMessenger/8.0.42.2460(0x28002A35) WeChat/arm64 Weixin Android Tablet NetType/WIFI Language/zh_CN ABI/arm64",
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/wxpic,image/tpg,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7",
"X-Requested-With": "com.tencent.mm",
"Accept-Encoding": "gzip, deflate",
"Accept-Language": "zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7",
"Cookie": cookie
}
# 设置cookie
response2 = requests.get(url2, headers=headers2)
url3 = "http://pay.zk2016.com/api/web/SignIn.do"
headers3 = {"Host": "pay.zk2016.com", "Content-Length": "98"}
data3 = {"CustID": CustID, "PlaceID": PlaceID}
response3 = requests.post(url3, headers=headers3, data=json.dumps(data3))
result_msg = response3.json().get('ResultMsg')
print('签到信息:', result_msg)
response1 = requests.post(url1, headers=headers1, data=json.dumps(data1))
response_data1 = response1.json()
wealthlist = response_data1.get('wealthlist', [])
wealth_after_sign = ''
for item in wealthlist:
if item.get('name') == '存币':
wealth_after_sign = item.get('num')
print('总存币:', wealth_after_sign)
user_info = {}
user_info['username'] = username
user_info['wealth_before_sign'] = wealth_before_sign
user_info['result_msg'] = result_msg
user_info['wealth_after_sign'] = wealth_after_sign
user_dic[CustID] = user_info
return user_dic
# params = "c4b#os03Ksg#oGwGAv7vVA#8a9-0dcb;&c4b2cc7#Lltk#oGwU8#4-5ed;"
def get_param_info(params):
if params is None:
print("环境变量zzdwc未设置")
return []
params = params.split('&')
if not params:
print("未提供参数")
return []
user_ls = []
for param in params:
parts = param.split('#')
if len(parts) != 4:
print(f"参数格式错误:{param}")
continue
PlaceID, WechatId, PublicOpenID, CustID = parts
CustID = CustID.rstrip(';')
user_info = {
'PlaceID': PlaceID,
'WechatId': WechatId,
'PublicOpenID': PublicOpenID,
'CustID': CustID
}
user_ls.append(user_info)
return user_ls
def get_wealth(PlaceID,WechatId,PublicOpenID):
url1 = "http://pay.zk2016.com/api/web/getwealth.do"
headers1 = {"Host": "pay.zk2016.com", "Content-Length": "138"}
data1 = {"PlaceID": PlaceID, "WechatId": WechatId, "PublicOpenID": PublicOpenID}
response1 = requests.post(url1, headers=headers1, data=json.dumps(data1))
cookies = response1.cookies.get_dict()
cookies_str = ','.join([f'{key}={value}' for key, value in cookies.items()])
response_data1 = response1.json()
cookie = "serveropenid_215ab968-3797-e911-85df-d7af90092ad6=" + WechatId + ";" + "branchopenid_wxc89501e85bc2b259_215ab968-3797-e911-85df-d7af90092ad6=" + PublicOpenID + "; BranchID=215ab968-3797-e911-85df-d7af90092ad6; PublicPlaceID215ab968-3797-e911-85df-d7af90092ad6=c4bf4cdd-a5f3-4e0d-926f-7f67e2042cc7; placeName215ab968-3797-e911-85df-d7af90092ad6=%u90D1%u5DDE%u57CE%u5E02%u82F1%u96C4%u65E0%u9650%u57CE%u5E97;" + cookies_str
username = response_data1.get('userinfo', {}).get('SecondName')
print('用户名:', username)
wealthlist = response_data1.get('wealthlist', [])
wealth_before_sign = ''
for item in wealthlist:
if item.get('name') == '存币':
wealth_before_sign = item.get('num')
print('当前存币:', wealth_before_sign)
return username,wealth_before_sign,cookie
def set_cookie(PlaceID,cookie):
url2 = "http://pay.zk2016.com/web/signin.do?PlaceID=" + PlaceID
headers2 = {
"Host": "pay.zk2016.com",
"Connection": "keep-alive",
"Upgrade-Insecure-Requests": "1",
"User-Agent": "Mozilla/5.0 (Linux; Android 12; M2007J17C Build/SKQ1.211006.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/111.0.5563.116 Mobile Safari/537.36 XWEB/5317 MMWEBSDK/20230805 MMWEBID/3914 MicroMessenger/8.0.42.2460(0x28002A35) WeChat/arm64 Weixin Android Tablet NetType/WIFI Language/zh_CN ABI/arm64",
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/wxpic,image/tpg,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7",
"X-Requested-With": "com.tencent.mm",
"Accept-Encoding": "gzip, deflate",
"Accept-Language": "zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7",
"Cookie": cookie
}
response2 = requests.get(url2, headers=headers2)
def do_sign(PlaceID,WechatId,PublicOpenID,CustID):
url3 = "http://pay.zk2016.com/api/web/SignIn.do"
headers3 = {"Host": "pay.zk2016.com", "Content-Length": "98"}
data3 = {"CustID": CustID, "PlaceID": PlaceID}
response3 = requests.post(url3, headers=headers3, data=json.dumps(data3))
result_msg = response3.json().get('ResultMsg')
print('签到信息:', result_msg)
print("签到之后")
username,wealth_after_sign,cookie = get_wealth(PlaceID,WechatId,PublicOpenID)
print("----------------")
return wealth_after_sign,result_msg
def push_data(content):
push_url = "https://www.pushplus.plus/send"
PUSH_PLUS_TOKEN = os.getenv('PUSH_PLUS_TOKEN')
if PUSH_PLUS_TOKEN is None:
print("环境变量PUSH_PLUS_TOKEN未设置")
else:
push_data = {
"token": PUSH_PLUS_TOKEN,
"title": "郑州二七区城市英雄电玩城11121",
"content": content
}
response = requests.post(push_url, data=push_data)
if response.status_code != 200:
print("Push+推送失败")
else:
print("Push+推送成功")
def sign():
params = os.getenv('zzdwc')
us = get_param_info(params)
user_json = "共 {} 个 用户,".format(len(us))
num = 1
if len(us) > 0:
for a in us:
username, wealth_before_sign, cookie = get_wealth(a['PlaceID'], a['WechatId'], a['PublicOpenID'])
a['username'] = username
a['wealth_before_sign'] = wealth_before_sign
a['cookie'] = cookie
set_cookie(a['PlaceID'], cookie)
wealth_after_sign, result_msg = do_sign(a['PlaceID'], a['WechatId'], a['PublicOpenID'], a['CustID'])
cc = "当前是第{}个用户\n 用户名: {}\n当前存币: {}\n签到信息: {}\n总存币: {}\n+++++++++\n".format(num, username,
wealth_before_sign,
result_msg,
wealth_after_sign)
user_json += cc
num = num + 1
else:
print("用户信息为空")
push_data(user_json)
if __name__ == '__main__':
sign()
版权申明:
请先 !