Android tcpdump 使用

/**************************************************************************
 *                       Android tcpdump 使用
 * 说明:
 *     调试网卡问题,富林提醒我在主板上使用tcpdmp抓包,PC机上用Wireshark抓包,
 * 结果发现下行数据是可以的,上行数据有问题。
 *
 *                                  2017-4-12 深圳 龙华民治樟坑村 曾剑锋
 *************************************************************************/

一、参考文档:
    1. Android常用抓包工具之TcpDump
        http://blog.tingyun.com/web/article/detail/480
    2. android使用tcpdump抓包
        http://codingnow.cn/android/1633.html

二、操作方法:
    1. android tcpdump shell命令:tcpdump -vv -i eth0 host 10.10.10.10 &
    2. PC机cmd命令:ping 10.10.10.10
        C:\Users\zengjf>ping 10.10.10.10

        正在 Ping 10.10.10.10 具有 32 字节的数据:
        来自 10.10.10.15 的回复: 无法访问目标主机。
        请求超时。
        请求超时。
        请求超时。

        10.10.10.10 的 Ping 统计信息:
            数据包: 已发送 = 4,已接收 = 1,丢失 = 3 (75% 丢失),
    3. 操作输出:
        root@sabresd_6dq:/ # ifconfig eth0 10.10.10.10 netmask 255.255.255.0
        root@sabresd_6dq:/ # busybox ifconfig                                          
        eth0      Link encap:Ethernet  HWaddr 7C:CB:E2:E0:28:07  
                  inet addr:10.10.10.10  Bcast:10.10.10.255  Mask:255.255.255.0
                  inet6 addr: fe80::7ecb:e2ff:fee0:2807/64 Scope:Link
                  UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
                  RX packets:245 errors:0 dropped:0 overruns:0 frame:0
                  TX packets:35 errors:0 dropped:0 overruns:0 carrier:0
                  collisions:0 txqueuelen:1000 
                  RX bytes:23604 (23.0 KiB)  TX bytes:7482 (7.3 KiB)
        
        lo        Link encap:Local Loopback  
                  inet addr:127.0.0.1  Mask:255.0.0.0
                  inet6 addr: ::1/128 Scope:Host
                  UP LOOPBACK RUNNING  MTU:65536  Metric:1
                  RX packets:16 errors:0 dropped:0 overruns:0 frame:0
                  TX packets:16 errors:0 dropped:0 overruns:0 carrier:0
                  collisions:0 txqueuelen:0 
                  RX bytes:1344 (1.3 KiB)  TX bytes:1344 (1.3 KiB)
        
        root@sabresd_6dq:/ # tcpdump -vv -i eth0 host 10.10.10.10 &                    
        [1] 1145
        root@sabresd_6dq:/ # device eth0 entered promiscuous mode
        tcpdump: listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes
        00:05:32.544047 ARP, Ethernet (len 6), IPv4 (len 4), Request who-has 10.10.10.10 tell 10.10.10.15, length 46
        00:05:32.544131 ARP, Ethernet (len 6), IPv4 (len 4), Reply 10.10.10.10 is-at 7c:cb:e2:e0:28:07 (oui Unknown), length 28
        00:05:33.365689 ARP, Ethernet (len 6), IPv4 (len 4), Request who-has 10.10.10.10 tell 10.10.10.15, length 46
        00:05:33.365747 ARP, Ethernet (len 6), IPv4 (len 4), Reply 10.10.10.10 is-at 7c:cb:e2:e0:28:07 (oui Unknown), length 28
        00:05:34.365755 ARP, Ethernet (len 6), IPv4 (len 4), Request who-has 10.10.10.10 tell 10.10.10.15, length 46
        00:05:34.365836 ARP, Ethernet (len 6), IPv4 (len 4), Reply 10.10.10.10 is-at 7c:cb:e2:e0:28:07 (oui Unknown), length 28
        00:06:35.364318 ARP, Ethernet (len 6), IPv4 (len 4), Request who-has 10.10.10.10 tell 10.10.10.15, length 46
        00:06:35.364401 ARP, Ethernet (len 6), IPv4 (len 4), Reply 10.10.10.10 is-at 7c:cb:e2:e0:28:07 (oui Unknown), length 28
        

 

posted on 2017-04-12 09:02  zengjf  阅读(420)  评论(0编辑  收藏  举报

导航