mitmproxy cheat sheet

I use Charles Proxy pretty much nonstop when testing. As a backup I use mitmproxy. It lacks a bit of the polished UI that Charles provides, but it is free and open source. And it gets cool points for being a command line tool.

These notes cover only a fraction of what mitmproxy can do, but is pretty much everything I need most days.

Install

brew install mitmproxy

Help

mitmproxy --help

Start proxy on port 8989

mitmproxy --listen-port 8989 --ssl-insecure
--set console_mouse=false

The ssl-insecure flag ignores insecure SSL sites, which is common in a lot of the test environments I use. The console_mouse option makes it easier to copy/paste output from the terminal.

Start reverse proxy on port 8989 that directs traffic to port 4001

mitmproxy —-listen-port 8989 —-ssl-insecure
-—set console_mouse=false
-—mode reverse:http://localhost:4001
  • j/k: down/up
  • enter: select request
  • q: back/quit
  • z: clear requests