[Python] 纯文本查看 复制代码
from mitmproxy import http import decimal import json import datetime import re def set_game_data(game_data): datas = game_data["currencies"]["list"] for i in datas.keys(): if i.startswith(("Event", "Quest")): continue datas[i]["amount"] = str(decimal.Decimal("1E+100000000")) datas[i]["total_collected"] = str(decimal.Decimal("1E+100000000")) datas = game_data["upgrades"]["list"] # 捕获速度 datas["Catching_Speed"]["lvl"] = 340 # 货物容量 datas["Capacity"]["lvl"] = 130 # 捕获触手 datas["Catching_Tentacles"]["lvl"] = 25 # 群攻 datas["Group_Attack"]["lvl"] = 12 # 移动速度 datas["Move_Speed"]["lvl"] = 150 # 捕获范围 datas["Catching_Radius"]["lvl"] = 180 # 生命值 datas["HP"]["lvl"] = 100 # 帮手 # datas["Bot_Catchers"]["lvl"] = 0 datas["Bot_Catching_speed"]["lvl"] = 100000000 datas["Bot_Catchers_Cargo"]["lvl"] = 100000000 # 送货员 # datas["Bot_Delivers"]["lvl"] = 0 datas["Bot_Delivers_Cargo"]["lvl"] = 100000000 # 去除 帮手 送货员 datas = game_data["heroes"]["list"] for key in list(datas.keys()): if datas[key]["key"] == "bot_catcher": game_data["upgrades"]["list"]["Bot_Catchers"]["lvl"] -= 1 del datas[key] elif datas[key]["key"] == "bot_deliver": game_data["upgrades"]["list"]["Bot_Delivers"]["lvl"] -= 1 del datas[key] class MyProxy: game_data_url_reg = re.compile( r"^https://simplestorage.landintheair.com/newstorage/.*?/.*?/Main$" ) def request(self, flow: http.HTTPFlow): # 修改上传服务器的存档数据 if self.game_data_url_reg.match(flow.request.url) and flow.request.method == "POST": game_data = json.loads(flow.request.content) set_game_data(game_data) flow.request.content = json.dumps(game_data, ensure_ascii=False).encode() def response(self, flow: http.HTTPFlow): # 修改下载服务器的数据 if self.game_data_url_reg.match(flow.request.url) and flow.request.method == "GET": data = json.loads(flow.response.content) game_data = json.loads(data["data"]) set_game_data(game_data) data["data"] = json.dumps(game_data, ensure_ascii=False) flow.response.content = json.dumps(data, ensure_ascii=False).encode() addons = [MyProxy()]