Mitmproxy is a packet capture program that supports HTTP and HTTPS. It has functions similar to Fiddler and Charles, but it is a console in the form of operation.

Mitmproxy also has two associated components. One is mitmdump, which is the command line interface of MitmProxy. With it, we can interconnect with Python scripts and use Python to realize the processing after listening. The other is mitmWeb, which is a Web application through which we can clearly observe the requests captured by mitmProxy.

Here’s how to use them.

First, preparation

Ensure that mitmProxy has been correctly installed, mobile phones and PCS are on the same LAN, and the MITmProxy CA certificate has been configured.

Ii. Functions of MitmProxy

Mitmproxy has the following functions.




















Real-time processing of HTTP requests and responses using Python.

3. Principle of packet capture

Like Charles, mitmProxy runs on its own PC. Mitmproxy will run on port 8080 of the PC and then start a proxy service, which is actually an HTTP/HTTPS proxy.

Mobile phone and PC are in the same LAN, set proxy as the proxy address of MITmProxy, so that when mobile phone accesses the Internet, traffic packets will flow through MitmProxy, and mitmProxy forwards these packets to the real server. When the server returns packets, MitmProxy forwards them back to mobile phone. In this way, mitmProxy acts as a middleman to capture all Request and Response. In addition, mitmdump can be connected to this process, and the specific contents of the captured Request and Response can be directly processed by Python. For example, after obtaining the Response, we can directly parse it and then store it in the database, thus completing the data parsing and stored procedure.

Click to view the original article