Instructions
http://source.android.com/porting/tcpdump.html
Source Code and Documents
http://www.tcpdump.org/
Compiled Binary Download
http://www.strazzere.com/android/tcpdump
数据包分析工具Wireshark
http://www.wireshark.org/download.html


Installing tcpdump

Pushing the binary to an existing device
Download tcpdump from http://www.tcpdump.org/, then execute:
adb rootadb remountadb push /wherever/you/put/tcpdump /system/xbin/tcpdumpadb shell chmod 6755 /data/local/tmp/tcpdump


Running tcpdump
You need to have root access on your device.
Batch mode capture
The typical procedure is to capture packets to a file and then examine the file on the desktop, as illustrated below:
adb shell 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 ...adb pull /sdcard/capture.pcap .sudo apt-get install wireshark  # or ethereal, if you're still on dapperwireshark capture.pcap          # or ethereal   ... look at your packets and be wise ...


You can run tcpdump in the background from an interactive shell or from Terminal. By default, tcpdump captures all traffic without filtering. If you prefer, add an expression like port 80 to the tcpdump command line.

Real time packet monitoring
Execute the following if you would like to watch packets go by rather than capturing them to a file (-n skips DNS lookups. -s 0 captures the entire packet rather than just the header):
adb shell tcpdump -n -s 0


Typical tcpdump options apply. For example, if you want to see HTTP traffic:
adb shell tcpdump -X -n -s 0 port 80

更多相关文章

  1. Android(安卓)打开关闭闪光灯工具类
  2. Android(安卓)Studio 运行时出现 finished with non-zero exit v
  3. android Notification 工具类
  4. Android(安卓)ShutdownThread.java源码分析
  5. android mvvm livedata_一文搞懂Android(安卓)JetPack组件原理之
  6. Android工程的编译过程
  7. android简陋的开发工具
  8. Android应用程序窗口(Activity)的运行上下文环境(Context)的创建过程
  9. Android系统移植与调试之------->Android(安卓)Make分析

随机推荐

  1. Android图像处理之GPUImage for Android
  2. android注解初始化view
  3. [转]android Android SDK Setup的使用及
  4. android——获取手机联系人的工具类
  5. Android UI自定义Spinner下拉框(用popuwin
  6. 选项卡的使用方法一(Android学习随笔十二)
  7. 通过JavaScript或PHP检测Android设备的代
  8. Android中的Spinner的用法详解
  9. Android application context/activity c
  10. 解决TextView中MaxLines与ellipsize=end