How to capture Android packetsFirst, the principle of mobile device access network
First look at how the mobile device to access the network, 1, you can see, the mobile side of the packet is out of the WiFi.
Figure 1 (Mobile device access Network)
So we can put their own computer to open hot spots, the phone connected to the computer, the machine's Fiddler on the agent, so that the data through Fiddler, then Fiddler can catch these packets, and then sent to the router, 2 shows
Figure 2 (Setup)
Ii. fiddler the conditions required to crawl Android packets
1, the computer needs to install fiddler
2, the test phone needs to support WiFi
3. Test phone and computer need the same network
4, the test app needs to support the agent
Note: Iphone, Ipad, Winphone and other support agent phones are applicable
Three, the following describes how fiddler and Android need to set 1, the first computer to turn on WiFi hotspot
The computer can download a WiFi software, I use the Cheetah wifi,3 is shown, the computer has turned on the WiFi hotspot
Figure 3 (Wi-Fi on your phone)
2, set the proxy port of fiddler
Tools–> options-> Connections, set the proxy port: 8888, tick allow remote computers to connect, which is allowed to connect remotely to the computer as shown in fiddler,4
Note: 8888 is the default port number, can be modified, but pay attention to two points, one is the local idle port, and the second is the mobile phone proxy settings to be consistent with the fiddler port.
Figure 4 (Setting the proxy port for fiddler)
3. Set up network data to decrypt HTTPS
Tools–> options-> HTTPS, tick "Decrypt HTTPS traffic", "Ignore Server certificate Errors", 5
Figure 5 (Setting up network data to decrypt HTTPS)
4. View the wireless network card IP of this machine
After setting up the above steps, you can see the IP of your native wireless card in fiddler (if not, restart the fiddler, or you can find your network card in cmd ipconfig IP, Note: Be sure to turn on the local WiFi hotspot ), 6
Figure 6 (View native wireless network card IP in fiddler)
You can also view the IP of the local NIC in cmd, enter the command: ipconfig,7
Figure 7 (ipconfig view native wireless network card IP)
5.
The phone connects to the local WiFi and sets the agent
Each brand of mobile phone set up WiFi may not be the same way, here in the case of Huawei Mobile phone, 8, connect the phone to the PC's WiFi
Figure 8 (Wi-Fi on your phone)
Check "Show advanced Options", Agent Select "Manual", enter the server hostname and server port->ip Select "DHCP"-connect, that is, complete the mobile Terminal Settings Agent operation, 9 shown
Note: Server hostname: Fiddler is located on the computer IP (that is, after turning on WiFi, in the fiddler or CMD to see the Wireless network card IP address)
Server port: The port used by fiddler (that is, the number set in Options-> connections)
Figure 9 (Phone settings Agent)
6, mobile phone download install fiddler certificate
After connecting the WiFi, the phone opens the browser input proxy ip+ port number (that is, the local wireless network card IP, is also the server host name set when the phone is connected to WiFi, here the ip+ port number is 192.168.191.1:8888), into fiddler Echo Service page, download fiddler certificate, 10, click Fiddlerroot Certificate
Figure 10 (Download fiddler certificate)
After the download is complete, install the certificate as shown in 11
Figure 11 (Installation certificate)
Note: If you open your browser and encounter an error similar to the following, open the Fiddler certificate decryption Mode (as shown in step 3 above): No root certificate was found. Are you enabled for HTTPS traffic decryption in Fiddler yet?
Four, running mobile phone applications
After setting up the above 6 steps, it means that it is set up, and when you access the app with your phone, you can see the packets that Fiddler fetched, 12, 13
Figure 12 (This is the data packet captured when running the Baidu network disk and the Himalaya FM application)
Figure 13 (This is the packet crawled when running the game in the app)
The above is what fiddler to do when capturing an Android packet
Grab Bag Tool-Fiddler (how to capture Android packets)