Android利用tcpdump抓包

来源:互联网 发布:漫威漫画软件 编辑:程序博客网 时间:2024/05/16 22:28
 

Android利用tcpdump抓包

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:
Cmd代码 复制代码 收藏代码
  1. adb root   
  2. adb remount   
  3. adb push /wherever/you/put/tcpdump /system/xbin/tcpdump   
  4. adb 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:
Cmd代码 复制代码 收藏代码
  1. adb shell tcpdump -i any -p -s 0 -w /sdcard/capture.pcap   
  2. "-i any": listen on any network interface   
  3. "-p": disable promiscuous mode (doesn't work anyway)   
  4. "-s 0": capture the entire packet   
  5. "-w": write packets to a file (rather than printing to stdout)   
  6.   
  7.    ... do whatever you want to capture, then ^C to stop it ...   
  8.   
  9. adb pull /sdcard/capture.pcap .   
  10. sudo apt-get install wireshark  # or ethereal, if you're still on dapper   
  11. wireshark capture.pcap          # or ethereal   
  12.   
  13.    ... 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):
Cmd代码 复制代码 收藏代码
  1. adb shell tcpdump -n -s 0  


Typical tcpdump options apply. For example, if you want to see HTTP traffic:
Cmd代码 复制代码 收藏代码
  1. adb shell tcpdump -X -n -s 0 port 80  

原创粉丝点击
热门问题 老师的惩罚 人脸识别 我在镇武司摸鱼那些年 重生之率土为王 我在大康的咸鱼生活 盘龙之生命进化 天生仙种 凡人之先天五行 春回大明朝 姑娘不必设防,我是瞎子 婴儿大便常规正常的腹泻怎么办 宝宝十个月母乳不够吃怎么办 吃药上吐腹泻在3怎么办 房子买了新生儿户口怎么办 吃海鲜拉稀拉水怎么办 吃海鲜腹泻拉水怎么办 两个月宝宝不爱睡觉怎么办 2个月宝宝干呕怎么办 9个月宝宝拉稀的怎么办 宝宝拉肚子快一个月了怎么办 满月宝宝发烧38度怎么办 大人腹泻10天了怎么办 十个月宝贝拉水怎么办 十个月宝宝脱水哭闹怎么办 宝宝肠胃不好老是拉肚子怎么办 七个月的宝宝老是拉肚子怎么办 6个月宝宝拉肚子怎么办 没满月宝宝吐奶怎么办 八个月宝宝有点拉肚子怎么办 4个月宝宝拉水怎么办 2岁宝宝消化不好拉肚子怎么办 两岁宝宝老拉肚子怎么办 2岁宝宝拉肚子老不好怎么办 2岁宝宝一直拉肚子不好怎么办 5天新生儿拉稀水怎么办 4天新生儿拉稀水怎么办 新生儿40天拉稀水怎么办 一周多的宝宝拉肚子怎么办 出生半个月的宝宝拉肚子怎么办 刚出生几天的宝宝拉肚子怎么办 刚出生的宝宝拉肚子怎么办 出生八天的宝宝拉肚子怎么办 刚出生婴儿拉水怎么办 三岁宝宝一直吐怎么办 3岁宝宝一直吐怎么办 5个月宝宝一直吐怎么办 新生儿睡反了觉怎么办 吃母乳奶流量大怎么办 两个月宝宝有痰怎么办 婴儿瞌睡睡倒了怎么办 侧切伤口崩开了怎么办