1. Enable Linux in Windows10

  1. Click in the control panelEnable or disable Windows functions
  2. Check the Windows subsystem for Linux
  3. Wait for configuration and restart if prompted
  4. Open the Windows Store, search for Linux, and select Ubuntu (I chose Ubuntu 18.04 here)
  5. After the installation is complete, you will be asked to set up a login username and password, enter the username and press Enter, then password, press Enter, then password, press Enter. (PS: ***** number is not displayed when entering the password, but it is recorded)

2. Use Python to install mitmProxy.

  1. Start Ubuntu 18.04.

  2. Install python3’s package management tool PIp3 in Ubuntu 18.04 (the default Python in Ubuntu 18.04 is already Python3.6).

    Enter the command sudo apt-get install -y python-pip3 and it will prompt you for your password. Enter the password you just set. Run the pip3 -v command to check whether the installation is successful. If information similar to the following is displayed, the installation is successful:

    PIP 9.0.1 from /usr/lib/python3/dist-packages (Python 3.6)

  3. Install mitmproxy

    Enter pip3 install mitmproxy

  4. Generating a CA certificate:

    Enter mitmdump in terminal, we can find CA certificate in user directory. Mitmproxy directory, there are 5 certificates in total:

Name | description -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - | -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- mitmproxy - ca. Pem | pem format of the certificate of the private key mitmproxy - ca - cert. Pem | pem format certificate, Apply to most of the Windows platform mitmproxy - ca - cert. P12 | as PKCS12 format of the certificate, apply to the Windows platform mitmproxy - ca - cert. Cer | and mitmproxy - ca - cert. Pem is same, just change the suffix, Applicable to the part of the Android platform mitmproxy - dhparam. Pem | pem format of the secret key file, used to enhance the SSL securityCopy the code

Mitmproxy-ca-cert. pem is the certificate we want to install in Ubuntu

3. Ubuntu Installation Certificate:

  1. First switch to the certificate directorycd .mitmproxy
  2. Install the certificate in Ubuntu: How-do-i-install -a-root-certificate Refer to this section to install the certificate.

According to the scum translation of this article:

  1. conversionmitmproxy-ca-cert.pemFormat file is the correspondingmitmproxy-ca-cert.crtTo format the file, enter the following command:openssl x509 -in mitmproxy-ca-cert.pem -inform PEM -out mitmproxy-ca-cert.crt
  2. Create an additional directory in **/usr/share/ca-certificates** :sudo mkdir /usr/share/ca-certificates/extra
  3. Copy and transform okaymitmproxy-ca-cert.crtFile to the directory you just created:sudo cp mitmproxy-ca-cert.crt /usr/share/ca-certificates/extra/mitmproxy-ca-cert.crt
  4. Let Ubuntu add the directory of the.crt file to /etc/ca-certificate. conf to the /etc/ca-certificate. conf file:sudo dpkg-reconfigure ca-certificatesPress Enter to enter the user password.
  5. A box will pop up:

    Press Enter and a box will pop up:

    Use Spaces to add what you just addedmitmproxy-ca-cert.crtSelect the certificate, as shown in the figure above, and press Enter to wait for the system to update the certificate information

  6. Then startmitmproxy, enter it in the Ubuntu terminalmitmproxy, the screenshot is as follows:

4. Mobile phone installation Certificate:

  1. Mobile phones and computers are in the same network, so mobile phone proxy needs to be set first (it is better to add a MITmProxy proxy with relevant scientific Internet software, which is convenient to enable and close) :

    IOS Settings – wireless LAN – Click the wifi name of the current link – Configure proxy – Manual: Enter the IP address of the computer where MITmProxy is installed at the server, fill in the port 8080, and then save.

  1. Turn off the firewall

    Turn off the firewall of your computer, otherwise you cannot install certificates and capture relevant information

mitm.it
Make sure mitmProxy is enabled in Ubuntu, the relevant firewall is turned off, and the correct phone proxy is set up

  1. Settings – General – Description files & Device Management – Trust mitmProxy files
  2. Settings – General – About native – Certificate Trust Settings – mitmPOxy file
  1. Android Settings are pretty much the same, so I won’t go into details.

  2. Open the Ubuntu18.04 terminal window and run mitmProxy (if it is running, please skip it). When you open the web page or APP on your mobile phone, you can see relevant information captured by MitmProxy.

Since then, Winodws10 uses the built-in Linux system to install mitmProxy for packet capture is complete!

Cancel the agent

Right! Remember to cancel the proxy you set !!!!! when you stop the mitmporxy program Don’t blame me for not reminding you!