To capture TCP packets on the Android platform, you can use the TCPdump tool.
1 Download Tcpdump for Android platform
http://www.tcpdump.org
2 Push to your phone
You need root permission,
adb root
adb remount
adb push directory\tcpdump /data/local/tcpdump
adb shell chmod 6755 /data/local/tcpdump
3 Capture packets
adb shell tcpdump -w /data/capture0.pcap
adb shell tcpdump ip 10.1.2.13 and 10.2.3.12 -w /data/capture1.pcap
or
adb shell tcpdump -p-vv -s 0 -w /sdcard/capture .pcap
# "-p": disable promiscuous mode (doesn't work anyway)
# "-s 0": capture the entire packet
# "-w": write packets to a file (rather than printing to stdout)
... do whatever you want to capture, then ^C to stop it...
4 Export log
adb pull /data/capture0.pcap /home/linghu/
adb pull /sdcard/capture.pcap /home/linghu/
5 Analysis
Use Wireshark to download wireshark to view the data packets, the address is http://www.wireshark.org /download.html.
Tcpdump grabs Android network packets
Guess you like
Origin http://10.200.1.11:23101/article/api/json?id=326849588&siteId=291194637
Recommended
Ranking