jumpstart-games-reduxed/mitm-redirect.py
2023-06-19 19:59:42 +02:00

26 lines
797 B
Python

from mitmproxy import ctx
import mitmproxy.http
def routable(path):
methods = ['GetRules', 'LoginParent', 'RegisterParent', 'GetSubscriptionInfo', 'GetUserInfoByApiToken', 'IsValidApiToken_V2', 'ValidateName', 'GetDefaultNameSuggestion', 'RegisterChild', 'GetProfileByUserId', 'LoginChild', 'GetUserProfileByUserID', 'GetKeyValuePair', 'SetKeyValuePair']
for method in methods:
if method in path:
return True
return False
class LocalRedirect:
def __init__(self):
print('Loaded redirect addon')
def request(self, flow: mitmproxy.http.HTTPFlow):
if 'api.jumpstart.com' in flow.request.pretty_host and routable(flow.request.path):
flow.request.host = "localhost"
flow.request.scheme = 'http'
flow.request.port = 5000
addons = [
LocalRedirect()
]