The way is to install tcpdump on the Android machine, and then through the-w parameter to the capture packet to local, and then the caught. cap file to the PC with Wireshark to analyze. There are a lot of steps here, and the efficiency is very low when the background is linked.
Can you start the grab on Android and see the real-time capture results directly on the PC?
With the ADB debug Bridge, we can do so conveniently.
First, the Preparation tool:
1、android 系统root2、android上安装tcpdump3、android上安装netcat,可以直接使用busybox的版本4、pc的wireshark的安装目录下需要有nc客户端5、把android手机和pc通过usb调试连接上
Second, the Order:
1, Android first execution:
0 -w - | nc -l -p 11234
* 11234 is an example, the port can be set by itself
2. Start adb forward on PC:
adb forward tcp:11234 tcp:11234 && nc64 127.0.0.1 11234 | wireshark -k -S -i -
* Here's 11234 to be and the front to enable 11234 to remain consistent
3, if the clutch success, then the PC-side Wireshark is automatically started, and can see the network packet
Three, the realization principle:
The key logic in ADB forward this command, which implements the function of port mapping:
Go: Android-developed network capture