Skip to content

Instantly share code, notes, and snippets.

@drygdryg
Last active July 1, 2024 09:10
Show Gist options
  • Save drygdryg/2f7b7a57736b60258b0577bf42e6ef1b to your computer and use it in GitHub Desktop.
Save drygdryg/2f7b7a57736b60258b0577bf42e6ef1b to your computer and use it in GitHub Desktop.
Install mitmproxy in Termux

Termux mitmrpoxy installation

Tested on Android 13 with mitmproxy 10.1.5, Python 3.11.6.

Install required system packages

pkg upgrade
pkg install python pipx rust binutils

Setup pipx:

pipx ensurepath
source .bashrc

Set necessary C compiler flags

This flag is required for building ruamel.yaml.clib (see termux/termux-packages#16746):

export CFLAGS="-Wno-incompatible-function-pointer-types"

Install mitmproxy

pipx install mitmproxy

Run

Run mitmproxy, mitmweb or mitmdump.

Notes

  • if you need to intercept and analyze requests from a certain Android application, you can use ProxyDroid to force that application to use mitmweb as proxy server; another option is to use Mitmproxy in the Wireguard (transparent proxy) mode with an Wireguard client;
  • to install mitmproxy CA certificate, grab it from .mitmproxy directory and install it using Android system settings:
termux-setup-storage
cp ~/.mitmproxy/mitmproxy-ca-cert.pem ~/storage/downloads/
  • to make the mitmproxy CA certificate trusted, you can use MagiskTrustUserCerts Magisk module to make the certificate part of the system certificate store.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment