Skip to content

Instantly share code, notes, and snippets.

@litwak913
Created October 10, 2023 19:33
Show Gist options
  • Save litwak913/9b11e0306e19e4b6c6aa0dddaf655fe0 to your computer and use it in GitHub Desktop.
Save litwak913/9b11e0306e19e4b6c6aa0dddaf655fe0 to your computer and use it in GitHub Desktop.
测试 mitmproxy
import mitmproxy.http
from mitmproxy import ctx,http
import json
class PCLToken:
def response(self,flow:mitmproxy.http.HTTPFlow):
if flow.request.host != 'api.minecraftservices.com':
return
isauth=False
if "authentication" in flow.request.url:
print("-----got api minecraftservice auth-----")
isauth=True
elif "profile" in flow.request.url:
print("-----got api minecraftservice profile-----")
obj=json.loads(flow.response.text)
#print(obj)
if isauth:
print(f"access_token:{obj['access_token']}")
else:
print(f"uuid:{obj['id']}")
print(f"name:{obj['name']}")
print(f"skinurl:{obj['skins'][0]['url']}")
#flow.response.set_text("HELLO FROM MITMPROXY"+flow.response.text)
print("-----end request-----")
addons=[PCLToken()]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment