【问题标题】:Reading captured packet from command line with tcpdump使用 tcpdump 从命令行读取捕获的数据包
【发布时间】:2013-02-13 06:07:26
【问题描述】:

我正在使用以下方法捕获流量:

 tcpdump -i <interface> -nn  -s0 -w ike2.pcap

然后我正在使用以下方法读取捕获的文件:

tcpdump  -vvv -l -r ike2.pcap

读取时,第一个数据包显示为:

07:22:33.320142 IP (tos 0x0, ttl  64, id 0, offset 0, flags [DF], length: 296) 10.0.0.1.isakmp > 10.0.0.2.isakmp: [udp sum ok] isakmp 2.0 msgid  cookie ->: phase 1 I #34[]:
    (#33)
    (#34)
    (#40)
    (#41)
    (#41)

我需要获取此数据包的详细信息。在这个 ISAKMP IKEv2 数据包中,我有兴趣提取“加密算法”和“完整性算法”的值(即“ENCR_3DES”和“AUTH_HMAC_MD5_96”)

如果我在 Wireshark 中检查数据包,我可以查看这些值。但是,我必须从 shell 脚本执行此操作,所以我不能使用wireshark。我需要从 tcpdump 读取命令本身获取这些值。

我假设可能有一些方法可以打印 tcpdump 读取命令中使用的加密和完整性算法。请您帮忙解决这个问题。

捕获的数据包:

【问题讨论】:

    标签: shell tcpdump ipsec


    【解决方案1】:

    仅使用 tcpdump 就可以按照您的预期找到方法,但 @user862787 说使用 tshark 如下:

    # tshark -V -r somecapfile.pcap
    Frame 1: 196 bytes on wire (1568 bits), 196 bytes captured (1568 bits)
    Encapsulation type: Linux cooked-mode capture (25)
    Arrival Time: May 10, 2017 02:00:34.811347000 CDT
    [Time shift for this packet: 0.000000000 seconds]
    Epoch Time: 1494399634.811347000 seconds
    [Time delta from previous captured frame: 0.000000000 seconds]
    [Time delta from previous displayed frame: 0.000000000 seconds]
    [Time since reference or first frame: 0.000000000 seconds]
    Frame Number: 1
    Frame Length: 196 bytes (1568 bits)
    Capture Length: 196 bytes (1568 bits)
    [Frame is marked: False]
    [Frame is ignored: False]
    [Protocols in frame: sll:ethertype:ip:sctp:m3ua:sccp:tcap:gsm_map]
    

    -V 做你想做的事!

    【讨论】:

      【解决方案2】:

      如果我在 Wireshark 中检查数据包,我可以查看这些值。但是,我必须从 shell 脚本中执行此操作,所以我不能使用 wireshark。

      但你或许可以使用 TShark。

      【讨论】:

        【解决方案3】:

        tcpdump -r 带有一些其他标志(例如 -X)的文件。

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2020-09-16
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2013-01-14
          相关资源
          最近更新 更多