This repository has been archived by the owner on Aug 18, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
82 lines (64 loc) · 2.85 KB
/
main.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
import json
import os
from mitmproxy.options import Options
from mitmproxy.proxy.config import ProxyConfig
from mitmproxy.proxy.server import ProxyServer
from mitmproxy.tools.dump import DumpMaster
from mitmproxy.http import HTTPFlow
class Handler:
def __init__(self, port, info):
self.info = info
self.client_request_uuid = None
print(f'BiligameRemoveRealnameVerified(BRRV)已在端口{port}开启')
# 请求
def request(self, flow: HTTPFlow):
if flow.request.url.endswith("app/v2/time/heartbeat"):
for entry in str(flow.request.data.content)[2:-1].split("&"):
if entry.split("=")[0].__eq__("client_request_uuid"):
self.client_request_uuid = entry.split("=")[1]
flow.request.data.headers.clear()
flow.request.data.content = b""
# 响应
def response(self, flow: HTTPFlow):
if flow.request.url.endswith("app/v2/time/heartbeat"):
if self.client_request_uuid is not None:
data = json.loads("{}")
data["code"] = "0"
data["client_request_uuid"] = self.client_request_uuid
data["data"] = '{"user_info":{"adult_status":1,"tour_mark":0}}'
data["ts"] = 4
flow.response.set_text(str(data))
self.client_request_uuid = None
if self.info:
print("取消时间更新成功")
if str(flow.response.text).__contains__("realname_verified"):
data = json.loads(flow.response.text)
# 实名无效改实名方法已被修复
# if str(data["realname_verified"]).__eq__("1") and str(data["remind_status"]).__eq__("0"):
# data["remind_status"] = "1" # 实名是否无效
if str(data["realname_verified"]).__eq__("0"):
data["realname_verified"] = "1" # 是否实名
flow.response.set_text(str(data))
if self.info:
print("实名修改成功")
def dump(options):
server = DumpMaster(options, with_termlog=False, with_dumper=False)
server.server = ProxyServer(ProxyConfig(options))
return server
if __name__ == "__main__":
config = {}
if os.path.exists("./config.json"):
config = json.load(open("./config.json"))
if "host" not in config:
config["host"] = "0.0.0.0"
if "port" not in config:
config["port"] = 25560
if "info" not in config:
config["info"] = True
f = open("./config.json", "w")
f.write(json.dumps(config))
f.close()
master = dump(
Options(listen_host=config["host"], listen_port=config["port"], http2=False, ssl_insecure=True))
master.addons.add(Handler(config["port"], config["info"]))
master.run()