File size: 2,642 Bytes
09ac853
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import json

from mitmproxy import http, ctx

class MhwsRequest:
    def __init__(self) -> None:
        """
        mitmproxy -s mitm_server.py

        system.json
            https://hjm.rebe.capcom.com/systems/EAR-B-WW/00001/system.json
            https://server.mhwee.com/systems/EAR-B-WW/00001/system.json
            https://evi0mo-hf-fastapi.hf.space/systems/EAR-B-WW/00001/system.json
            
        multiplayer
            https://40912.playfabapi.com/MultiplayerServer/ListParty/QosServers
            https://evi0mo-hf-fastapi.hf.space/MultiplayerServer/ListParty/QosServers
        """

        # system.json
        self.original_rebe_host = "hjm.rebe.capcom.com"
        self.rebe_host = "evi0mo-hf-fastapi.hf.space"
        self.rebe_url = f"https://{self.rebe_host}/systems/EAR-B-WW/00001/system.json"
        self.rebe_data = {
            "json_ver": "1.0.2",
            "title": "EAR-B-WW",
            "revision": "00001",
            "api_timeout": 30000,
            "mtm": f"https://{self.rebe_host}",
            "mtms": "https://mtms.rebe.capcom.com",
            "mmr": "https://mmr.rebe.capcom.com",
            "tmr": f"https://{self.rebe_host}/v1/projects/earth-analysis-obt/topics/analysis-client-log:publish",
            "nkm": "https://nkm.rebe.capcom.com",
            "wlt": "https://wlt.rebe.capcom.com",
            "selector": "https://selector.gs.capcom.com",
            "working_state": "alive",
            "custom_property": "eyJvYnRfaW5mbyI6eyJlbnYiOjEsInN0YXJ0X3RpbWUiOjE3MzA0MjgyMDAsImVuZF90aW1lIjoxNzMwOTg5MjAwfSwicWEzIjp7ImFwaSI6IiIsIm5vdGlmeSI6IiJ9fQ=="
            }

        # multiplayer
        self.multiplayer_url = "https://40912.playfabapi.com/MultiplayerServer/ListParty/QosServers"
        

    def request(self, flow: http.HTTPFlow) -> None:
        if flow.request.pretty_url == self.rebe_url:
            ctx.log.alert(flow.request)
            flow.response = http.Response.make(
                status_code=200,
                content=json.dumps(self.rebe_data),
                headers={"Content-Type": "application/json; charset=utf-8"},
            )

        if flow.request.pretty_url == self.multiplayer_url:
            flow.response = http.Response.make(
                status_code=404,
                content="offline mode",
                headers={"Content-Type": "text/html"},
            )

        if flow.request.pretty_host == self.original_rebe_host:
            flow.request.host = self.rebe_host


    def response(self, flow: http.HTTPFlow) -> None:
        ctx.log.info(f"get response from: {flow.request.url}")


addons = [
    MhwsRequest()
]