Created
May 3, 2017 15:22
-
-
Save rajiteh/bd04bcb7a535d93827fd7f285e98d7d5 to your computer and use it in GitHub Desktop.
Sets up mitmproxy as a transparent reverse proxy to any upstream (as defined by the host header of the http packets)
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
# | |
# ./mitmproxy -U http://doesnt.matter -p 8001 -s mitmproxy_transparent_reverse_proxy.py | |
# | |
# HTTP_PROXY=http://localhost:8001 ./program_to_run | |
# | |
def request(flow): | |
if flow.request.method == "CONNECT": | |
return | |
if flow.live: | |
flow.live.change_upstream_proxy_server((flow.request.host, flow.request.port)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment