用tcpdump抓取Android的网络数据包

0、手机要有root权限

1、下载tcpdump

地址:http://www.strazzere.com/android/tcpdump

2、将它导入到手机

adb push d:\tcpdump /data/local/tmp/tcpdump

3、修改权限使它可执行

adb shell

cd /data/local/tmp/

chmod 777 tcpdump

4、运行tcpdump进行抓包

./tcpdump -h

 ./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 ...

5、将tcpdump文件导入电脑 

 adb pull /sdcard/capture.pcap capture.pcap 

然后,用wireshark打开即可看到数据包的详细信息。


你可能感兴趣的:(Android辅助工具)