-
-
Save litwak913/9b11e0306e19e4b6c6aa0dddaf655fe0 to your computer and use it in GitHub Desktop.
测试 mitmproxy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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