Python3 crawler actual -7, APP crawling related library is installed: MitmProxy Installation

MitmProxy is a HTTP and HTTPS packet capture program, similar to Fiddler, Charles function, except that it is in the form of a console operation.
Meanwhile MitmProxy There are two related components, one is MitmDump, it is MitmProxy command line interface, we can use it docked Python script, after listening process implemented in Python. Another is MitmWeb, it is a Web application, we can clearly observe the request MitmProxy captured by it.
In this section we look at MitmProxy, MitmDump, MitmWeb installation.

1. Links

2. Pip installation

The easiest way to install or use Pip, can be installed directly execute the following command:

pip3 install mitmproxy

This is the most simple and versatile installation to complete the installation after MitmProxy finished, also install the MitmDump, MitmWeb two components, if you do not install this way can also choose to use specifically for each platform listed below Docker installation or mounting.

Installation under 3. Mac

Mac is easy to install, use HomeBrew can be ordered as follows:

brew install mitmproxy
Python资源分享qun 784758214 ,内有安装包,PDF,学习视频,这里是Python学习者的聚集地,零基础,进阶,都欢迎

MitmProxy to complete the installation after executing the command.

Installation 4. Docker

MitmProxy also supports Docker, whose address is Docker Hubhttps://hub.docker.com/r/mitm ...
Docker under MitmProxy installation command is:

docker run --rm -it -p 8080:8080 mitmproxy/mitmproxy mitmdump

This port was launched in 8080 and MitmProxy MitmDump.
If you want to retrieve a CA certificate, you can choose to mount disk option, the command is as follows:

docker run --rm -it -v ~/.mitmproxy:/home/mitmproxy/.mitmproxy -p 8080:8080 mitmproxy/mitmproxy mitmdump

Such a CA certificate can be found in ~ / .mitmproxy directory.
Also can start MitmWeb on port 8081, the command is as follows:

docker run --rm -it -p 8080:8080 -p 127.0.0.1:8081:8081mitmproxy/mitmproxy mitmweb
Python资源分享qun 784758214 ,内有安装包,PDF,学习视频,这里是Python学习者的聚集地,零基础,进阶,都欢迎

More start-up mode can refer to the installation instructions Docker Hub.

5. certificate configuration

For MitmProxy, if you want to intercept HTTPS requests, we need to set up the certificate, MitmProxy after installation will provide a CA certificate, as long as the client trust certificates MitmProxy offer, we can get specific content HTTPS request by MitmProxy otherwise MitmProxy is unable to resolve HTTPS requests.
First, run the following command to generate the CA certificate, you can start MitmDump:
mitmdump
so you can start MitmDump, then we can find the CA certificate in .mitmproxy directory under the user directory, shown in Figure 1-61:

Python3 crawler actual -7, APP crawling related library is installed: MitmProxy Installation

Figure 1-61 certificate file
the certificate a total of five, five Below is a description of these certificates:

Python3 crawler actual -7, APP crawling related library is installed: MitmProxy Installation

Here we introduce the Mac, iOS, Android platform in the certificate configuration process.

Mac

Mac double-click mitmproxy-ca-cert.pem to bring up the keychain management page, and then find mitmproxy certificate, click to open its settings, you can choose to always trust, as shown in Figure 1-66:

Python3 crawler actual -7, APP crawling related library is installed: MitmProxy Installation

Figure 1-66 Certificate Configuration
This configuration Mac under the trusted CA certificate.

iOS

Transmitting mitmproxy-ca-cert.pem files to the iPhone, recommended transmission mode mail, the iPhone can click and recognize the installed accessory, as shown in FIG. 1-67:

Python3 crawler actual -7, APP crawling related library is installed: MitmProxy Installation

Figure 1-67 Certificate Installation page
will jump to install the profile after clicking the page, click on the Install button to install the upper right corner, where there will be a warning message shown in Figure 1-68:

Python3 crawler actual -7, APP crawling related library is installed: MitmProxy Installation

Figure 1-68 install warning page
continue to click on the top right corner of the installation, will be prompted installed after the installation is successful, as shown in Figure 1-69:

Python3 crawler actual -7, APP crawling related library is installed: MitmProxy Installation

If your iOS version is 10.3 or less, the flow trusted CA certificate here has been completed.
If your iOS version 10.3 and above, but also in Settings -> General -> About -> Certificate trust settings will add the certificate trust completely, as shown 1-70:

Python3 crawler actual -7, APP crawling related library is installed: MitmProxy Installation

FIG 1-70 certificate trust provided
herein fully trust the MitmProxy switch to open.
Such configuration process trusted CA certificate on iOS is over.
Android
android phone also needs to send the certificate mitmproxy-ca-cert.pem files to the phone, for example, copy files directly. Python resource sharing qun 784758214, there are installation package, PDF, learning videos, here is the gathering place for learners Python, zero-based, advanced, are welcome
Next, click a certificate prompt window will appear, as shown in Figure 1-71 It shows:

Python3 crawler actual -7, APP crawling related library is installed: MitmProxy Installation

Figure 1-71 Certificate Installation page
then enter the name of the certificate, and then click OK to complete the installation.

6. Conclusion

In this section we understand MitmProxy, MitmDump, MitmWeb installation, later we will use it to grab the APP data.

Guess you like

Origin blog.51cto.com/14445003/2424876