如果要抓TCP数据包,我们可以使用TCPdump工具,类似于windows/linux下使用的这个工具一样。具体方法是
下载tcpdump, 还有个地址是http://www.strazzere.com/android/tcpdump,不知道具体版本。
详细使用请参考http://www.tcpdump.org/里面的文档
你需要root权限,
adb push c:\wherever_you_put\tcpdump /data/local/tcpdump adb shell chmod 6755 /data/local/tcpdump 抓包很简单 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 ... 导出 adb pull /sdcard/capture.pcap . 下载wireshark查看数据包,地址是http://www.wireshark.org/download.html,打开这个数据包,就可以查看数据包内容了。
参考文档:http://prem-android.blogspot.com/2009/03/capture-packets-in-android-tcpdump.html
http://nerdjusttyped.blogspot.com/2009/03/android-binary-solo.html
本文介绍如何在Android设备上使用TCPdump工具捕获TCP数据包。首先需要将TCPdump工具推送到设备上,并通过ADB命令设置执行权限。然后运行TCPdump进行数据包捕获,并保存为pcap文件。最后使用Wireshark查看捕获的数据包。
&spm=1001.2101.3001.5002&articleId=83724989&d=1&t=3&u=8efeb7af7bc84cd5b8910f02063bb347)
155

被折叠的 条评论
为什么被折叠?



