mitmproxy
mitmproxy is an interactive man-in-the-middle proxy for HTTP and HTTPS traffic. It allows inspection and editing of traffic flows on the fly via a console interface.
Description
mitmproxy serves as an SSL-capable man-in-the-middle HTTP proxy, enabling users to intercept, inspect, and modify HTTP and HTTPS requests and responses in real-time. It provides a console interface for interactive traffic manipulation, making it ideal for debugging, testing, and security analysis of web applications and network communications.
Key use cases include saving HTTP conversations for later replay and analysis, replaying client-side or server-side interactions, and operating in reverse proxy or transparent proxy modes on Linux and OSX. The tool also supports scripted modifications to HTTP traffic using Python, enhancing automation for complex testing scenarios.
Additionally, mitmdump offers a command-line alternative to mitmproxy with identical core functionality but without the graphical interface, similar to tcpdump for HTTP traffic. mitmweb provides a web-based UI for easier interaction.
How It Works
mitmproxy operates as a man-in-the-middle proxy that intercepts HTTP and HTTPS traffic by binding to a specified host and port, defaulting to 8080 for regular HTTP proxy. It generates SSL/TLS certificates on the fly for secure interception, allowing transparent proxying on supported platforms. Traffic flows can be filtered, viewed, modified via patterns for bodies, headers, remote mappings, or local files, and replayed from saved flows. Python scripting enables custom modifications, with mitmdump providing non-interactive dumping and mitmweb a web interface.
Installation
sudo apt install mitmproxyFlags
Examples
mitmproxy -p 2139mitmdump -hmitmproxy -hmitmweb -hmitmdump [filter]mitmproxy -p 8080mitmdump --client-replay file.flowmitmproxy --listen-port 8080 --intercept '~u /api'