android抓包及分析

操作步骤

1、adb shell

  进入shell

2、netcfg

  查看网络连接

3、tcpdump -i rmnet0 -v -s 0 -w /sdcard/test.pcap 

  利用tcpdump来抓包,保存到/sdcard/test.pcap。

  输入上面命令,点击回车开始抓包,按ctrl+C结束抓包。

4、导出pcap包,利用wireshark查看数据包。

5、Wireshark使用手册http://man.lupaworld.com/content/network/wireshark/

 

 其他参考博文:

如果要抓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/tcpdumpadb 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 ... packets-in-android- tcpdump.html
http://nerdjusttyped.blogspot.co ... id-binary-solo.html
http://www.gker.net/bbs/viewthread.php?tid=77&extra=

posted @ 2012-08-07 18:10  天南星客  阅读(879)  评论(0编辑  收藏  举报