android中使用tcpdump攔截分析網絡數據包

1、下載tcpdump
http://pan.baidu.com/s/1c0vkU2k

2、通過adb命令上傳到手機裏
adb push tcpdump /system/bin

3、adb shell tcpdump -p -vv -s 0 -w /sdcard/capture.pcap

1
2
3
4
5
6
7
8
9
#tcpdump 用法:
 
tcpdump -i any -p -s 0 -w /sdcard/capture.pcap
命令參數:
# "-i any": listen on any network interface
# "-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、運行要截包的app,完成對應操作後,CTRL + C 終止,然後通過下面命令取出命令:
adb pull /sdcard/capture.pcap

5、通過wireshark打開capture.pcap文件,查看對應的數據,如下圖:


轉自:http://www.yinqisen.cn/blog-470.html

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章