mitmproxy Cheatsheet - Packet Capture & Debugging Reference

Browser DevTools only sees what your own browser sent; to see other apps' HTTPS traffic you need a MITM proxy. This reference covers mitmproxy/mitmdump/mitmweb modes and ports, filter expressions, flow interception/editing, addon scripts, and the CA-cert install that decrypts HTTPS. Use it when debugging a mobile app, an old client, or a scheduled job that doesn't go through the browser. After reading you can capture, filter and even rewrite live API calls.

Dev Tools·37 commands·Last updated 2026-07-21
mitmproxyPacket CaptureProxy

Startup & Modes 7

mitmproxy
Start the interactive UI
mitmweb
Start the Web UI
mitmdump
Command-line mode (like tcpdump)
mitmproxy -p 8080
Specify a port
mitmproxy --mode transparent
Transparent proxy mode
mitmproxy --mode upstream:http://proxy:8080
Upstream proxy mode
mitmproxy --listen-host 0.0.0.0
Listen on all addresses

Filter Expressions 11

~u example.com
URL contains example.com
~d example.com
Domain contains example.com
~m GET
Method is GET
~c 200
Status code 200
~h "Content-Type: json"
Header contains
~b "error"
Request or response body contains
~q
Requests only
~s
Responses only
~t "text/html"
Content-Type matches
~u example.com & ~m GET
Combined filter (AND)
~u example.com | ~u test.com
Combined filter (OR)

Interactive Operations 10

?
View help
q
Quit
e
Edit request/response
r
Replay request
w
Save to file
W
Stream-save to file
/
Search
n
Create new request
I
Intercept mode toggle
F
Set focus-follow

Scripting & Modification 5

mitmproxy -s script.py
Load a script
mitmdump -s script.py -w outfile
Script + save traffic
mitmproxy --set blocklist=example.com
Block a domain
mitmproxy --set modify_headers="~q|Host:example.com"
Modify request headers
mitmproxy --set modify_body="~q|regex|replace"
Modify request body

HTTPS Certificates 4

mitmproxy --set ssl_insecure=true
Skip upstream cert verification
Visit http://mitm.it to download the cert
Download the CA cert on the client
~/.mitmproxy/mitmproxy-ca-cert.pem
CA certificate path
security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain cert.pem
Install cert on macOS

Tips

  • HTTPS capture needs the mitmproxy CA cert installed on the client.
  • Transparent proxy mode needs iptables or routing; good for mobile capture.
  • Scripts are written in Python and can implement complex request modifications.

Official References

Each command links to its official documentation below, so you can verify the latest usage and read deeper.

Maintained by LaoHand

Publicly updated on Jul 21, 2026, continuously proofread against official docs.

Contact Us

Wrong command or description? Send us corrections, business inquiries or product feedback by email.

Contact Us