安卓手机抓包

来源:互联网 发布:淘宝达人申请认证理由 编辑:程序博客网 时间:2024/04/28 08:51

电脑上抓包软件已经很多了,可是,这次老总要求对手机抓包。一下子问住我了。第一个方案,是手机局域网上网,然后用局域网监听工具来监听。不过
尝试几个软件都不是太满意
然后就是准备用tcpdump,直接在手机上抓包了。
准备工作,1.下载java环境 2.andriod的sdk(关键是需要里面的adb.exe)3.下载wireshark(这个用来看监听的数据包)
然后就是运行命令
adb root 
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 .