diff --git a/private_server_launch.bat b/private_server_launch.bat index 447becd..2f28f9d 100644 --- a/private_server_launch.bat +++ b/private_server_launch.bat @@ -6,7 +6,10 @@ SET ip=%1 SET gamePath=%2 SET gamePath=%gamePath:"=% -start "Proxy Server" ./ext/mitmdump.exe -s "./proxy/proxy.py" --ssl-insecure +start "Proxy Server" ./ext/mitmdump.exe -s "./proxy/proxy.py" --ssl-insecure --set ip=%ip% + +:: Allow the proxy to start +ping 192.0.2.2 -n 1 -w 5000 > nul echo Opening %gamePath%/Genshin Impact Game/GenshinImpact.exe diff --git a/proxy/proxy.py b/proxy/proxy.py index 90bbcdc..841e8fc 100644 --- a/proxy/proxy.py +++ b/proxy/proxy.py @@ -20,14 +20,23 @@ # ## +import string +from mitmproxy import ctx from mitmproxy import http class MlgmXyysd_Genshin_Impact_Proxy: + def load(self, loader): + loader.add_option( + name = "ip", + typespec = str, + default = "localhost", + help = "IP address to replace", + ) + def request(self, flow: http.HTTPFlow) -> None: - # This can also be replaced with another IP address. - REMOTE_HOST = "localhost" + REMOTE_HOST = ctx.options.ip LIST_DOMAINS = [ "api-os-takumi.mihoyo.com",