Skip to content

Instantly share code, notes, and snippets.

@zhgchgli0718
Last active September 20, 2019 08:49
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 zhgchgli0718/cfe95541f4f250d187c11bcb22b38ed8 to your computer and use it in GitHub Desktop.
Save zhgchgli0718/cfe95541f4f250d187c11bcb22b38ed8 to your computer and use it in GitHub Desktop.
from mitmproxy import http
def request(flow: http.HTTPFlow) -> None:
# pretty_host takes the "Host" header of the request into account,
# which is useful in transparent mode where we usually only have the IP
# otherwise.
# 請求參數設定 Example:
flow.request.headers['User-Agent'] = 'MitmProxy'
if flow.request.pretty_host == "123.com.tw":
flow.request.host = "456.com.tw"
# 將123.com.tw的訪問全導到456.com.tw
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment