原文链接:http://mysuperbaby.iteye.com/blog/902201

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:

  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:

  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. ... do whatever you want to capture, then ^C to stop it ...
  7. adb pull /sdcard/capture.pcap .
  8. sudo apt-get install wireshark  # or ethereal, if you're still on dapper
  9. wireshark capture.pcap          # or ethereal
  10. ... 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):

  1. adb shell tcpdump -n -s 0

Typical tcpdump options apply. For example, if you want to see HTTP traffic:

  1. adb shell tcpdump -X -n -s 0 port 80

[转] Android利用tcpdump抓包的更多相关文章

  1. Android利用tcpdump抓包,用wireshark分析包。

    1.前言 主要介绍在android手机上如何利用tcpdump抓包,用wireshark分析包. android tcpdump官网: http://www.androidtcpdump.com/ t ...

  2. Android手机tcpdump抓包

    在开发过程中遇到问题时,无法非常方便的获取到数据包,导致分析解决问题比较麻烦.这里介绍如何在Android手机上实现tcpdump抓包.   1.root机器  在用tcpdump抓包过程中,需要使用 ...

  3. linux下利用tcpdump抓包工具排查nginx获取客户端真实IP实例

    一.nginx后端负载服务器的API在获取客户端IP时始终只能获取nginx的代理服务器IP,排查nginx配置如下 upstream sms-resp { server ; server ; } s ...

  4. android下tcpdump抓包

    tcpdump是最快捷方便的抓包方式,还可以加深对网络协议的理解.android下可以通过如下方式抓包: 1 Android上启动tcpdump Android设备可以把tcpdump的可执行文件上传 ...

  5. Android通过tcpdump抓包(wifi, 2g, 3g都可以)

    http://blog.csdn.net/deng529828/article/details/20646197 1. 手机要有root权限 2. 下载tcpdump   http://www.str ...

  6. Android使用tcpdump抓包

    AllJoyn中有个问题:Server切换到Client后,重新加入其他Server时join session会失败,原因是timeout(join session是异步的,在指定时间内没有收到回应) ...

  7. 利用tcpdump抓包工具监控TCP连接的三次握手和断开连接的四次挥手

    TCP传输控制协议是面向连接的可靠的传输层协议,在进行数据传输之前,需要在传输数据的两端(客户端和服务器端)创建一个连接,这个连接由一对插口地址唯一标识,即是在IP报文首部的源IP地址.目的IP地址, ...

  8. Android通过tcpdump抓包

    1. 手机要有root权限 2. 下载tcpdump   http://www.strazzere.com/android/tcpdump 3. adb push c:\wherever_you_pu ...

  9. 转:android root tcpdump抓包强烈推荐

    转:http://www.cnblogs.com/findyou/p/3491035.html 写的相当详细且完整,业界良心. adb push d:\tcpdump /data/local/ adb ...

随机推荐

  1. 该不该用inline-block取代float? inline和float的区别?

    该不该用inline-block取代float? 请看这篇文章引用: jtyjty99999的博客 让块级元素 水平排列的通常方式是float, 但是float可能会带来很多意外的问题 可以考虑用in ...

  2. Windows Phone 开发环境的搭建

    1. 系统 系统:Windows 7(32 位).Windows 7(64 位).Windows Vista SP2(32 位)和 Windows Vista(64 位)或者更高版本. 不支持 :Wi ...

  3. MSP430G2333下位机乘法运算需要注意的一个问题

    背景: 最近负责为主板管理电源的电源管理模块编写软体,使用的MCU为MSP430G2333.功能上很简单,即通过板子上的硬件拨码设定,或者通过IIC与主板通信,由主板的BIOS决定开机及关机的延时供电 ...

  4. hdu.1430.魔板(bfs + 康托展开)

    魔板 Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submis ...

  5. Try-Catch机制使用场景分析

    (一)在什么场景下加Try-Catch机制   1)以业务逻辑功能为单位,在最上层加Try-Catch机制.为什么要这样做呢?这主要是增加程序的健壮性,防止因抛出异常过多,导致程序崩溃. try { ...

  6. 高性能Java网络框架 MINA

    Apache MINA(Multipurpose Infrastructure for Network Applications) 是 Apache 组织一个较新的项目,它为开发高性能和高可用性的网络 ...

  7. Xcode 7 App Transport Security has blocked a cleartext HTTP 报错解决办法

    Xcode 7 创建新项目用到 UIWebView 发送请求时,报下面的错: “App Transport Security has blocked a cleartext HTTP (http:// ...

  8. 使用text存储hash类型的数据 Use text filed to store the hash map

    在component表里用text类型的字段存储hash数据 (1)新建字段 ,这是migration的内容 class AddHintsToComponents < ActiveRecord: ...

  9. C++笔试题(转)

    http://blog.csdn.net/hxz_qlh/article/details/16864567 这里面列举的题考察的东西都非常细,包括strcpy,字符串,大.小端的判断,很容易犯错,值得 ...

  10. java写文件

                                  randomAccessFile.close();              }                  e.printStack ...