若是要抓TCP數據包,咱們可使用TCPdump工具,相似於windows/linux下使用的這個工具同樣。具體方法是html
下載tcpdump, 還有個地址是http://www.strazzere.com/android/tcpdump,不知道具體版本。linux
詳細使用請參考http://www.tcpdump.org/裏面的文檔android
adb shell am start -a android.intent.action.VIEW -d http://www.baidu.comshell
你須要root權限,windows
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.htmltcp
http://nerdjusttyped.blogspot.com/2009/03/android-binary-solo.html工具