From b20b695f114691fae42c5b1ef6e963f561f2e8bd Mon Sep 17 00:00:00 2001 From: mkbka <99542134+mkbka@users.noreply.github.com> Date: Mon, 3 Jun 2024 19:39:37 +0800 Subject: [PATCH] add mitmproxy script --- Scripts/redirect_server.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 Scripts/redirect_server.py diff --git a/Scripts/redirect_server.py b/Scripts/redirect_server.py new file mode 100644 index 0000000..a199b83 --- /dev/null +++ b/Scripts/redirect_server.py @@ -0,0 +1,22 @@ +from mitmproxy import http + +SERVER_HOST = 'YOUR_SERVER_HERE' +SERVER_PORT = 80 + +REWRITE_HOST_LIST = [ + 'ba-jp-sdk.bluearchive.jp', + 'prod-gateway.bluearchiveyostar.com', + 'prod-game.bluearchiveyostar.com', + # 'prod-notice.bluearchiveyostar.com', + # 'prod-logcollector.bluearchiveyostar.com', +] + +def request(flow: http.HTTPFlow) -> None: + if flow.request.pretty_host.endswith('log.aliyuncs.com'): + flow.kill() + return + if flow.request.pretty_host in REWRITE_HOST_LIST: + flow.request.scheme = 'http' + flow.request.host = SERVER_HOST + flow.request.port = SERVER_PORT + return