### Install mitmproxy using Homebrew Source: https://mitmproxy.org Use this command to install mitmproxy on macOS or Linux systems with Homebrew. ```bash brew install mitmproxy ``` -------------------------------- ### Python Script for mitmproxy Addon Source: https://mitmproxy.org This Python script demonstrates how to create a mitmproxy addon. It shows how to redirect requests to a different host and how to respond directly from the proxy. ```python from mitmproxy import http def request(flow: http.HTTPFlow): # redirect to different host if flow.request.pretty_host == "example.com": flow.request.host = "mitmproxy.org" # answer from proxy elif flow.request.path.endswith("/brew"): flow.response = http.Response.make( 418, **b**"I'm a teapot", ) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.