Big Bug Ban

兴趣 践行 创新

Archive for 1月, 2014

android开发日志 使用tcpdump抓包

 

注意:

  • 手机需要有root的权限

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

[download id=”46″]

2. 执行下面命令 传输到手机里面,记得打开调试模式

adb push ./tcpdump /tmp/tcpdump

3. 改变执行权限

adb shell chmod 755 /tmp/tcpdump

4.

adb shell,   su获得root权限

5.

cd /tmp

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

6. 把输出的文件传回电脑

adb pull /sdcard/capture.pcap ~/

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

Written by princehaku

1月 31st, 2014 at 11:39 下午