[Android Pro] 利用tcpdump和wireshark对android网络请求进行分析

时间:2021-03-23 14:03:57
一: tcpdump操作流程

1. 手机要有root权限

2. 下载tcpdump   http://www.strazzere.com/android/tcpdump

3. adb push c:\wherever_you_put{color}tcpdump /data/local/tcpdump

4. adb shell chmod 6755 /data/local/tcpdump

5, adb shell,   su获得root权限

6, cd /data/local

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

8,  adb pull /sdcard/capture.pcap d:/

9,  在电脑上用wireshark打开capture.pcap即可分析log

二:wireshark 的操作流程

1:双击上面的capture.pcap文件用wireshark打开

2:在filter 过滤器出输入:http,回车,就能将所有的http都过滤出来。