mitmproxy on Ubuntu 20.04+

mitmproxy is a free and open source interactive HTTPS proxy.

To quickly get this up and running on Ubuntu 19.04 (Updated and tested in 20.04 & 21.04).

Install mitmproxy

sudo apt install mitmproxy  

This should install the latest version, if not you can get the binary direct from the website: https://mitmproxy.org

Start the proxy

For this demo we'll use port 8881 for the proxy but this can be anything not already in use.

For the command line version:

sudo mitmproxy -p 8881  

Or the web UI version

sudo mitmweb -p 8881 --web-port 8882  

Using 8882 as the web port, this will let you open http://127.0.0.1:8882/ to watch the traffic through but again this can be any port you like.

Or a socks5 proxy

sudo mitmproxy -p 8881 -m socks5  
or  
sudo mitmweb -p 8881 -m socks5 --web-port 8882  

Setup proxy

Open your Network settings and click to edit your Network Proxy.

Can also be found by going through chrome://settings/?search=proxy and clicking Open proxy settings

Set to Manual & set both your HTTP & HTTP proxies to localhost port 8881.

Setup SSL/TLS certificate for HTTPS support

This step is only needed the first time it's run.

Go to http://mitm.it/pem/cert which will download the certificate.

Then to import this into Chrome, head to chrome://settings/certificates and click Authorities & then click Import to select the downloaded certificate.

You may find this doesn't kick in with your existing Chrome session so try it our in Incognito/Private/Guest.

Enjoy

If using the command line version the requests will be listed as they come in. Use the up and down arrows to navigate around, press enter to view inside a request and then left & right between the tabs. You can also use your mouse to click the requests and tabs if easier. Then press q to go back to the requests list. Ctrl+c as often to exit.

Or if you're using the web UI, simply head over to http://127.0.0.1:8882/ and it'll start listing requests as you navigate the web.

Remember when you're done to disable your Network proxy setting when you're done with the proxy.

comments powered by Disqus
Want to setup your own server? Digital Ocean offer $100 free for new accounts.
DigitalOcean Referral Badge