Evilmass commited on
Commit
09ac853
·
1 Parent(s): 2551afb

add mitm_server

Browse files
Files changed (2) hide show
  1. .gitignore +2 -0
  2. mitm/mitm_server.py +70 -0
.gitignore ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ __pycache__/
2
+ *.pyc
mitm/mitm_server.py ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import json
2
+
3
+ from mitmproxy import http, ctx
4
+
5
+ class MhwsRequest:
6
+ def __init__(self) -> None:
7
+ """
8
+ mitmproxy -s mitm_server.py
9
+
10
+ system.json
11
+ https://hjm.rebe.capcom.com/systems/EAR-B-WW/00001/system.json
12
+ https://server.mhwee.com/systems/EAR-B-WW/00001/system.json
13
+ https://evi0mo-hf-fastapi.hf.space/systems/EAR-B-WW/00001/system.json
14
+
15
+ multiplayer
16
+ https://40912.playfabapi.com/MultiplayerServer/ListParty/QosServers
17
+ https://evi0mo-hf-fastapi.hf.space/MultiplayerServer/ListParty/QosServers
18
+ """
19
+
20
+ # system.json
21
+ self.original_rebe_host = "hjm.rebe.capcom.com"
22
+ self.rebe_host = "evi0mo-hf-fastapi.hf.space"
23
+ self.rebe_url = f"https://{self.rebe_host}/systems/EAR-B-WW/00001/system.json"
24
+ self.rebe_data = {
25
+ "json_ver": "1.0.2",
26
+ "title": "EAR-B-WW",
27
+ "revision": "00001",
28
+ "api_timeout": 30000,
29
+ "mtm": f"https://{self.rebe_host}",
30
+ "mtms": "https://mtms.rebe.capcom.com",
31
+ "mmr": "https://mmr.rebe.capcom.com",
32
+ "tmr": f"https://{self.rebe_host}/v1/projects/earth-analysis-obt/topics/analysis-client-log:publish",
33
+ "nkm": "https://nkm.rebe.capcom.com",
34
+ "wlt": "https://wlt.rebe.capcom.com",
35
+ "selector": "https://selector.gs.capcom.com",
36
+ "working_state": "alive",
37
+ "custom_property": "eyJvYnRfaW5mbyI6eyJlbnYiOjEsInN0YXJ0X3RpbWUiOjE3MzA0MjgyMDAsImVuZF90aW1lIjoxNzMwOTg5MjAwfSwicWEzIjp7ImFwaSI6IiIsIm5vdGlmeSI6IiJ9fQ=="
38
+ }
39
+
40
+ # multiplayer
41
+ self.multiplayer_url = "https://40912.playfabapi.com/MultiplayerServer/ListParty/QosServers"
42
+
43
+
44
+ def request(self, flow: http.HTTPFlow) -> None:
45
+ if flow.request.pretty_url == self.rebe_url:
46
+ ctx.log.alert(flow.request)
47
+ flow.response = http.Response.make(
48
+ status_code=200,
49
+ content=json.dumps(self.rebe_data),
50
+ headers={"Content-Type": "application/json; charset=utf-8"},
51
+ )
52
+
53
+ if flow.request.pretty_url == self.multiplayer_url:
54
+ flow.response = http.Response.make(
55
+ status_code=404,
56
+ content="offline mode",
57
+ headers={"Content-Type": "text/html"},
58
+ )
59
+
60
+ if flow.request.pretty_host == self.original_rebe_host:
61
+ flow.request.host = self.rebe_host
62
+
63
+
64
+ def response(self, flow: http.HTTPFlow) -> None:
65
+ ctx.log.info(f"get response from: {flow.request.url}")
66
+
67
+
68
+ addons = [
69
+ MhwsRequest()
70
+ ]