From ced378cee84a943532e45bab0de38e1e1d21c4da Mon Sep 17 00:00:00 2001 From: Jaida Wu Date: Thu, 21 Apr 2022 21:41:07 +0800 Subject: [PATCH] Add port & SSL options to proxy script Signed-off-by: Jaida Wu --- proxy.py | 9 ++++++++- proxy_config.py | 4 +++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/proxy.py b/proxy.py index 2d2282af9..86145cde6 100644 --- a/proxy.py +++ b/proxy.py @@ -16,12 +16,14 @@ # - mitmdump from mitmproxy # # @author MlgmXyysd -# @version 1.0 +# @version 1.1 # ## from mitmproxy import http +from proxy_config import USE_SSL from proxy_config import REMOTE_HOST +from proxy_config import REMOTE_PORT class MlgmXyysd_Genshin_Impact_Proxy: @@ -60,7 +62,12 @@ class MlgmXyysd_Genshin_Impact_Proxy: def request(self, flow: http.HTTPFlow) -> None: if flow.request.host in self.LIST_DOMAINS: + if USE_SSL: + flow.request.scheme = "https" + else: + flow.request.scheme = "http" flow.request.host = REMOTE_HOST + flow.request.port = REMOTE_PORT addons = [ MlgmXyysd_Genshin_Impact_Proxy() diff --git a/proxy_config.py b/proxy_config.py index f048ef88c..5025a974e 100644 --- a/proxy_config.py +++ b/proxy_config.py @@ -1,2 +1,4 @@ # This can also be replaced with another IP address. -REMOTE_HOST = "localhost" \ No newline at end of file +USE_SSL = True +REMOTE_HOST = "127.0.0.1" +REMOTE_PORT = 443 \ No newline at end of file