Getting Started with mitmproxy

Launch mitmweb

Start the mitmproxy web interface on port 8888:

mitmweb -p 8888 &

mitmproxy web interface


Configuring iOS Devices

  1. Set Up Proxy:
    In your Wi-Fi settings, configure the HTTP proxy to your computer’s IP address and port 8888.

  2. Install mitmproxy Certificate:

  • Open Safari and navigate to:
    http://mitm.it
  • Select iOS and follow the instructions to download the mitmproxy certificate.
  • Install the certificate by going to:
    Settings > General > Profile
    Tap on the downloaded profile and install it.
  1. Enable Full Trust:
    Navigate to:
    Settings > General > About > Certificate Trust Settings
    Enable full trust for the mitmproxy root certificate.

  2. Optional - Simulator Certificate Installation:
    For iOS simulators, you can install the certificate directly using:

xcrun simctl keychain booted add-root-cert /path/to/cert.pem

Configuring Android Devices

Debugging app

app/src/main/res/xml/network_security_config.xml

<network-security-config>
    <debug-overrides>
        <trust-anchors>
            <!-- Trust user added CAs while debuggable only -->
            <certificates src="user" />
            <certificates src="system" />
        </trust-anchors>
    </debug-overrides>

    <base-config cleartextTrafficPermitted="true">
        <trust-anchors>
            <certificates src="system" />
            <certificates src="user" />
        </trust-anchors>
    </base-config>
</network-security-config>

Android manifest

<application
      android:networkSecurityConfig="@xml/network_security_config"
/>

Option 1: Manual Proxy

  • Set the proxy in your Wi-Fi settings to point to your computer’s IP and port 8888.
  • Install mitmproxy Certificate:
    • Open a browser and go to:
      http://mitm.it
    • Select Android and follow the instructions to download the mitmproxy certificate.
    • Install the certificate by going to:
      Settings > Security > Install from storage
      Choose the downloaded certificate file.

Option 2: Using ADB

  1. Connect your Android device via ADB.

  2. Set the proxy:

    adb shell settings put global http_proxy <client-ip>:8888
    
  3. Remove Proxy (when finished):

    adb shell settings put global http_proxy :0
    

Note:
Remember to disable the proxy when you’re done. If not, your device may lose internet access when mitmproxy is not running.