Introduction#
mitmproxy allows you to intercept and analyze network traffic between your browser and the internet. To set up mitmproxy with Firefox, you need to configure Firefox to use mitmproxy as a proxy. This enables mitmproxy to capture and display all HTTP and HTTPS requests made by Firefox.
Downloading mitmproxy#
- Visit the official website at: https://mitmproxy.org/
- Download the Linux Binary file.
- Extract the tar.gz file with this command:
tar -xvf mitmproxy-10.1.6-linux-x86_64.tar.gz
Firefox - Proxy Configuration#
Open Firefox and go to the settings menu by clicking on the three horizontal lines in the upper right corner.
Select
Preferences
orOptions
from the menu.In the Preferences or Options window, find and click on
General
in the left sidebar.Scroll down to the
Network Settings
section.Click on the
Settings...
button next toConfigure how Firefox connects to the internet.
In the Connection Settings window, select
Manual proxy configuration.
For both
HTTP Proxy
andHTTPS Proxy,
enter the value127.0.0.1
and set the port to8080
. TheSOCKS Host
just ignore.
Tips: Or just Set
Also use this proxy for HTTPS.
- Click
OK
to close the Connection Settings window.
Running mitmproxy#
There has a few options to use mitmproxy. I recommend use mitmdump
for the terminal.
Open a terminal.
Navigate to the directory where mitmproxy is installed.
cd mitmproxy-bin
Run mitmproxy by executing the following command:
./mitmdump
mitmproxy will start, and you will see information about the proxy, including the proxy address (e.g.,
http://127.0.0.1:8080
).restart firefox.
Viewing Traffic in mitmproxy**#
Try to browse the internet in Firefox (launch browser), mitmproxy will capture and display the traffic in the terminal where mitmproxy is running.
For instance:
❯ ./mitmdump
[04:16:58.699] HTTP(S) proxy listening at *:8080.
[04:18:41.772][127.0.0.1:54868] client connect
[04:18:41.774][127.0.0.1:54876] client connect
[04:18:41.884][127.0.0.1:54868] server connect github.com:443 (20.27.177.113:443)
Exit mitmproxy#
To exit mitmproxy, press Ctrl + C
in the terminal where mitmproxy is running.
Conclusion#
By following these steps, you have successfully configured Firefox to use mitmproxy as a proxy, allowing you to monitor and analyze the network traffic generated by your browser.