Add port & SSL options to proxy script

Signed-off-by: Jaida Wu <mlgmxyysd@meowcat.org>
This commit is contained in:
Jaida Wu 2022-04-21 21:41:07 +08:00
parent 56415b7fbc
commit ced378cee8
No known key found for this signature in database
GPG Key ID: 2A5EF9CA5CD6B350
2 changed files with 11 additions and 2 deletions

View File

@ -16,12 +16,14 @@
# - mitmdump from mitmproxy # - mitmdump from mitmproxy
# #
# @author MlgmXyysd # @author MlgmXyysd
# @version 1.0 # @version 1.1
# #
## ##
from mitmproxy import http from mitmproxy import http
from proxy_config import USE_SSL
from proxy_config import REMOTE_HOST from proxy_config import REMOTE_HOST
from proxy_config import REMOTE_PORT
class MlgmXyysd_Genshin_Impact_Proxy: class MlgmXyysd_Genshin_Impact_Proxy:
@ -60,7 +62,12 @@ class MlgmXyysd_Genshin_Impact_Proxy:
def request(self, flow: http.HTTPFlow) -> None: def request(self, flow: http.HTTPFlow) -> None:
if flow.request.host in self.LIST_DOMAINS: 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.host = REMOTE_HOST
flow.request.port = REMOTE_PORT
addons = [ addons = [
MlgmXyysd_Genshin_Impact_Proxy() MlgmXyysd_Genshin_Impact_Proxy()

View File

@ -1,2 +1,4 @@
# This can also be replaced with another IP address. # This can also be replaced with another IP address.
REMOTE_HOST = "localhost" USE_SSL = True
REMOTE_HOST = "127.0.0.1"
REMOTE_PORT = 443