安卓手机tcpdump的使用
一.常规操作步骤
1. 手机要有root权限 2. 下载tcpdump http://www.strazzere.com/android/tcpdump 3. adb push c:\wherever_you_put\tcpdump /data/local/tcpdump 如果这一步真机无法push,可以用adb push c:\where_you_put\tcpdump /sdcard,即先将文件存入不需要权限的文件夹中,这里用sdcard,然后在传到/data/local/tcpdump。 4. adb shell chmod 6755 /data/local/tcpdump 5, adb shell,
6. su获得root权限
7, cd /data/local
8, ./tcpdump -i any -p -s 0 -w /sdcard/capture.pcap
注意:可以直接进入adb shell,通过tcpdum命令看看是否已经存在tcpdump,已存在的就不需要在下载传到手机了
命令参数:
# "-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 ...
下载tcpdump文件到电脑
adb pull /sdcard/capture.pcap capture.pcap #抓到的包导出到电脑,利用wireshark进行协助
然后用wireshark打开即可看到数据包的详细信息
附件地址:https://files.cnblogs.com/files/tjp40922/tcpdump.json 记得把文件尾缀去掉