zoukankan      html  css  js  c++  java
  • tcpdump抓包常用参数和用法

    tcpdump 与wireshark

    Wireshark(以前是ethereal)是Windows下非常简单易用的抓包工具。但在Linux下很难找到一个好用的图形化抓包工具。
    还好有Tcpdump。我们可以用Tcpdump + Wireshark 的完美组合实现:在 Linux 里抓包,然后在Windows 里分析包。

    [root@data-1-2 tools]# tcpdump tcp -s 0 -i eth0  and  host 10.0.3.81 -w /tools/0427.pcap
    tcpdump: listening on eth0, link-type EN10MB (Ethernet), capture size 262144 bytes
    ^C123 packets captured
    125 packets received by filter
    0 packets dropped by kernel
    [root@data-1-2 tools]# sz /tools/0427.pcap 
    
    [root@data-1-2 tools]# 
    

      

    参数解释

    (1)tcp: ip icmp arp rarp 和 tcp、udp、icmp这些选项等都要放到第一个参数的位置,用来过滤数据报的类型
    (2)-i eth0 : 只抓经过接口eth0的包
    (3)host 10.0.3.81  只抓取本机器和10.0.3.81机器之间的数据包
    (4)-s 0 : 抓取数据包时默认抓取长度为68字节。加上-s 0 后可以抓到完整的数据包
    (5)-w /tools/0427.pcap : 指定保存的路径保存成pcap文件,方便用ethereal(即wireshark)分析
    

      

    工作中最常用的是如下方式

    tcpdump tcp -s 0 -i eth0  and  host 10.0.3.81 -w /tools/0427.pcap
    
    tcpdump tcp -s 0 -i eth0  -w /tools/0427.pcap
    

      

    更多抓包匹配参数参照如下

    https://www.cnblogs.com/ggjucheng/archive/2012/01/14/2322659.html

  • 相关阅读:
    python类的继承
    Numpy float64和Python float是一样的
    ndarray的用法总结
    pandas的Panel类型dtype
    C++中类的前向声明
    numpy的searchsorted细品
    发现Boost官方文档的一处错误(numpy的ndarray)
    C++读取dll文件所在目录
    64位的pyd报"ImportError: No module named"错误
    WIN32,_WIN32_WIN64
  • 原文地址:https://www.cnblogs.com/nmap/p/8962808.html
Copyright © 2011-2022 走看看