mirror of
https://github.com/MatthewL246/mitmproxy-pretendo.git
synced 2026-04-25 07:52:48 -05:00
Add support for pretendo.network and reformat
(they hardcoded the website cookie domains)
This commit is contained in:
parent
b0789f111f
commit
2d05ef8c66
|
|
@ -6,7 +6,7 @@ class PretendoAddon:
|
|||
loader.add_option(
|
||||
name="pretendo_redirect",
|
||||
typespec=bool,
|
||||
default=False,
|
||||
default=True,
|
||||
help="Redirect all requests from Nintendo to Pretendo",
|
||||
)
|
||||
|
||||
|
|
@ -17,13 +17,6 @@ class PretendoAddon:
|
|||
help="Host to send Pretendo requests to (keeps the original host in the Host header)",
|
||||
)
|
||||
|
||||
loader.add_option(
|
||||
name="pretendo_http",
|
||||
typespec=bool,
|
||||
default=False,
|
||||
help="Sets Pretendo requests to HTTP (only applies if pretendo_host is set)",
|
||||
)
|
||||
|
||||
loader.add_option(
|
||||
name="pretendo_host_port",
|
||||
typespec=int,
|
||||
|
|
@ -31,20 +24,35 @@ class PretendoAddon:
|
|||
help="Port to send Pretendo requests to (only applies if pretendo_host is set)",
|
||||
)
|
||||
|
||||
loader.add_option(
|
||||
name="pretendo_http",
|
||||
typespec=bool,
|
||||
default=False,
|
||||
help="Sets Pretendo requests to HTTP (only applies if pretendo_host is set)",
|
||||
)
|
||||
|
||||
def request(self, flow: http.HTTPFlow) -> None:
|
||||
if ctx.options.pretendo_redirect:
|
||||
if 'nintendo.net' in flow.request.pretty_host:
|
||||
flow.request.host = flow.request.pretty_host.replace('nintendo.net', 'pretendo.cc')
|
||||
elif 'nintendowifi.net' in flow.request.pretty_host:
|
||||
flow.request.host = flow.request.pretty_host.replace('nintendowifi.net', 'pretendo.cc')
|
||||
if "nintendo.net" in flow.request.pretty_host:
|
||||
flow.request.host = flow.request.pretty_host.replace(
|
||||
"nintendo.net", "pretendo.cc"
|
||||
)
|
||||
elif "nintendowifi.net" in flow.request.pretty_host:
|
||||
flow.request.host = flow.request.pretty_host.replace(
|
||||
"nintendowifi.net", "pretendo.cc"
|
||||
)
|
||||
|
||||
if 'pretendo.cc' in flow.request.pretty_host and ctx.options.pretendo_host:
|
||||
if ctx.options.pretendo_host and (
|
||||
"pretendo.cc" in flow.request.pretty_host
|
||||
or "pretendo.network" in flow.request.pretty_host
|
||||
):
|
||||
original_host = flow.request.host_header
|
||||
flow.request.host = ctx.options.pretendo_host
|
||||
flow.request.port = ctx.options.pretendo_host_port
|
||||
flow.request.host_header = original_host
|
||||
|
||||
if ctx.options.pretendo_http:
|
||||
flow.request.scheme = 'http'
|
||||
flow.request.scheme = "http"
|
||||
|
||||
|
||||
addons = [PretendoAddon()]
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user