mitmproxy/examples/addons/internet_in_mirror.py

13 lines
344 B
Python
Raw Normal View History

"""
Mirror all web pages.
Useful if you are living down under.
"""
from mitmproxy import http
def response(flow: http.HTTPFlow) -> None:
2021-02-03 22:00:41 +00:00
assert flow.response # make type checker happy
reflector = b"<style>body {transform: scaleX(-1);}</style></head>"
flow.response.content = flow.response.content.replace(b"</head>", reflector)