forked from Darknights-dev/Darknights-server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmitm.proxy.py
20 lines (20 loc) · 911 Bytes
/
mitm.proxy.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import mitmproxy
# from mitmproxy.models import HTTPResponse
# from netlib.http import Headers
def request(flow):
host_name = flow.request.pretty_host
if host_name.endswith("gs.arknights.global") or host_name.endswith("passport.arknights.global"):
if (
'app/' not in flow.request.path and
'user/login' not in flow.request.path
# 'account/login' not in flow.request.path and
# 'account/syncData' not in flow.request.path
):
mitmproxy.ctx.log( flow.request.path )
# method = flow.request.path.split('/')[3].split('?')[0]
flow.request.host = "127.0.0.1"
flow.request.port = 9444
flow.request.scheme = 'http'
# if method == 'getjson':
# flow.request.path=flow.request.path.replace(method,"getxml")
flow.request.headers["Host"] = "127.0.0.1"