Set up mitmproxy (included mitmdump) - drasecurity/webtica-doc GitHub Wiki

Set Up mitmproxy (included mitmdump) - For HAR File Recording

Follow these steps to install and set up mitmproxy with a web interface to intercept HTTP(S) requests and export them as HAR files.

Step 1: Install mitmproxy

On macOS

You can install mitmproxy using Homebrew:

brew install mitmproxy

On Windows

Refer to mitmproxy documentation.

On Linux

Refer to mitmproxy documentation.

Step 2: Start mitmproxy

To start mitmproxy with a web interface, run:

mitmweb

This will start the mitmproxy web interface, accessible at http://localhost:8081.

Step 3: Configure Your Device/Browser

  1. Set Proxy: Configure your device or browser to use localhost and port 8080 as the HTTP proxy.

  2. Install the mitmproxy Certificate:

    • Open your web browser and navigate to http://mitm.it.
    • Follow the instructions to download and install the CA certificate for your operating system.

Step 4: Intercept HTTP(S) Requests

After setting up the proxy, all HTTP(S) traffic from your device/browser will be routed through mitmproxy. You can view the requests in the mitmweb interface.

Step 5: Export Requests as HAR File

  1. In the mitmweb interface, go to the Options tab.

  2. Check the Display Command Bar option.

  3. In the command bar at the bottom, type the following command:

    save.har @all example.har
    
  4. Press Enter. The file will be saved locally as example.har.

Conclusion

You have successfully installed and set up mitmproxy to intercept HTTP(S) requests and export them as HAR files.

For more information and detailed documentation, please refer to the official docs: mitmproxy Documentation.