From c77aa3ff79a274ac4cef12caf31da2309909f21a Mon Sep 17 00:00:00 2001 From: WangYneos Date: Sat, 23 Apr 2022 12:02:10 +0800 Subject: [PATCH 1/4] make mitmproxy ignore non Genshin hosts --- README.md | 2 +- start.cmd | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 853c37ae3..a08da974b 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ A WIP server reimplementation for *some anime game* 2.3-2.6 ### Connecting with the client ½. Create an account using *server console command* below 1. Run a proxy daemon: (choose either one) - - mitmdump: `mitmdump -s proxy.py -k` + - mitmdump: `mitmdump -s proxy.py -k`--allow-hosts ".*\.yuanshen\.com|.*\.mihoyo\.com|.*\.hoyoverse\.com" - Fiddler Classic: Run Fiddler Classic, turn on `Decrypt https traffic` in setting and change the default port there (Tools -> Options -> Connections) to anything other than `8888`, and load [this script](https://github.lunatic.moe/fiddlerscript). - [Hosts file](https://github.com/Melledy/Grasscutter/wiki/Running#traffic-route-map) 2. Trust CA certificate: diff --git a/start.cmd b/start.cmd index 8c89f359e..48de450d1 100644 --- a/start.cmd +++ b/start.cmd @@ -75,7 +75,7 @@ for /f "tokens=2*" %%a in ('reg query "HKCU\Software\Microsoft\Windows\CurrentVe @rem TODO: External proxy when ORIG_PROXY_ENABLE == 0x1 echo set ws = createobject("wscript.shell") > "%temp%\proxy.vbs" echo ws.currentdirectory = "%MITMDUMP_PATH%" >> "%temp%\proxy.vbs" -echo ws.run "cmd /c mitmdump.exe -s "^&chr(34)^&"%PROXY_SCRIPT_NAME%"^&chr(34)^&" -k",0 >> "%temp%\proxy.vbs" +echo ws.run "cmd /c mitmdump.exe -s "^&chr(34)^&"%PROXY_SCRIPT_NAME%"^&chr(34)^&" -k --allow-hosts \".*\.yuanshen\.com|.*\.mihoyo\.com|.*\.hoyoverse\.com\"",0 >> "%temp%\proxy.vbs" "%temp%\proxy.vbs" del /f /q "%temp%\proxy.vbs" >nul 2>nul From ae00eb69d67fd5b7561410f77f6426f0599fa8a3 Mon Sep 17 00:00:00 2001 From: WangYneos <42824603+WangYneos@users.noreply.github.com> Date: Sat, 23 Apr 2022 12:07:23 +0800 Subject: [PATCH 2/4] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a08da974b..370dc3c99 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ A WIP server reimplementation for *some anime game* 2.3-2.6 ### Connecting with the client ½. Create an account using *server console command* below 1. Run a proxy daemon: (choose either one) - - mitmdump: `mitmdump -s proxy.py -k`--allow-hosts ".*\.yuanshen\.com|.*\.mihoyo\.com|.*\.hoyoverse\.com" + - mitmdump: `mitmdump -s proxy.py -k --allow-hosts ".*\.yuanshen\.com|.*\.mihoyo\.com|.*\.hoyoverse\.com"` - Fiddler Classic: Run Fiddler Classic, turn on `Decrypt https traffic` in setting and change the default port there (Tools -> Options -> Connections) to anything other than `8888`, and load [this script](https://github.lunatic.moe/fiddlerscript). - [Hosts file](https://github.com/Melledy/Grasscutter/wiki/Running#traffic-route-map) 2. Trust CA certificate: From 22e5ca5545039df239bd0d6bb495c107fc206745 Mon Sep 17 00:00:00 2001 From: WangYneos <42824603+WangYneos@users.noreply.github.com> Date: Sat, 23 Apr 2022 13:57:48 +0800 Subject: [PATCH 3/4] Update start.cmd --- start.cmd | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/start.cmd b/start.cmd index 48de450d1..59ff78160 100644 --- a/start.cmd +++ b/start.cmd @@ -75,7 +75,7 @@ for /f "tokens=2*" %%a in ('reg query "HKCU\Software\Microsoft\Windows\CurrentVe @rem TODO: External proxy when ORIG_PROXY_ENABLE == 0x1 echo set ws = createobject("wscript.shell") > "%temp%\proxy.vbs" echo ws.currentdirectory = "%MITMDUMP_PATH%" >> "%temp%\proxy.vbs" -echo ws.run "cmd /c mitmdump.exe -s "^&chr(34)^&"%PROXY_SCRIPT_NAME%"^&chr(34)^&" -k --allow-hosts \".*\.yuanshen\.com|.*\.mihoyo\.com|.*\.hoyoverse\.com\"",0 >> "%temp%\proxy.vbs" +echo ws.run "cmd /c mitmdump.exe -s "^&chr(34)^&"%PROXY_SCRIPT_NAME%"^&chr(34)^&" -k --allow-hosts ^&chr(34)^&.*\.yuanshen\.com|.*\.mihoyo\.com|.*\.hoyoverse\.com^&chr(34)^&",0 >> "%temp%\proxy.vbs" "%temp%\proxy.vbs" del /f /q "%temp%\proxy.vbs" >nul 2>nul @@ -157,4 +157,4 @@ call :LOG [INFO] See you again :) goto :EOF :LOG -echo [%time:~0,8%] %* \ No newline at end of file +echo [%time:~0,8%] %* From 39e590dfb85988aa7c6e3cdad72f1a90edf238bd Mon Sep 17 00:00:00 2001 From: WangYneos Date: Sat, 23 Apr 2022 14:28:14 +0800 Subject: [PATCH 4/4] Fix Syntax --- start.cmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/start.cmd b/start.cmd index 59ff78160..c9dcc606f 100644 --- a/start.cmd +++ b/start.cmd @@ -75,7 +75,7 @@ for /f "tokens=2*" %%a in ('reg query "HKCU\Software\Microsoft\Windows\CurrentVe @rem TODO: External proxy when ORIG_PROXY_ENABLE == 0x1 echo set ws = createobject("wscript.shell") > "%temp%\proxy.vbs" echo ws.currentdirectory = "%MITMDUMP_PATH%" >> "%temp%\proxy.vbs" -echo ws.run "cmd /c mitmdump.exe -s "^&chr(34)^&"%PROXY_SCRIPT_NAME%"^&chr(34)^&" -k --allow-hosts ^&chr(34)^&.*\.yuanshen\.com|.*\.mihoyo\.com|.*\.hoyoverse\.com^&chr(34)^&",0 >> "%temp%\proxy.vbs" +echo ws.run "cmd /c mitmdump.exe -s "^&chr(34)^&"%PROXY_SCRIPT_NAME%"^&chr(34)^&" -k --allow-hosts "^&chr(34)^&".*\.yuanshen\.com|.*\.mihoyo\.com|.*\.hoyoverse\.com"^&chr(34),0 >> "%temp%\proxy.vbs" "%temp%\proxy.vbs" del /f /q "%temp%\proxy.vbs" >nul 2>nul