【问题标题】:How to filter package content in wireshark?如何过滤wireshark中的包内容?
【发布时间】:2016-11-03 09:54:01
【问题描述】:

我在Wireshark(2.0.3版)过滤包,tcp包数据是这样的:

7e:02:00:00:3c:01:41:31:07:17:83:02:97:00:00:00:00:00:0c:00:c3:02:28:ba:50:06:f1:ec:c0:00:59:00:00:01:2e:16:06:30:10:46:00:01:04:00:00:e6:2f:02:02:00:00:03:02:00:00:25:04:00:00:00:00:2b:04:00:00:00:00:30:01:13:31:01:12:5e:7e

现在我想找到第三个字节到第四个字节包含00:00,如何编写过滤表达式?我试过了:

ip[3,2] == 00:00     #in tcpdump it works

data.data[3,2] == 00:00    #data.data == 00:00,but data not just only contain:00:00

有什么办法吗?

【问题讨论】:

    标签: networking tcp wireshark


    【解决方案1】:

    计数从 0 开始,因此您在示例中查找 2 和 3。

    您可以指定和分组切片(您在示例中所做的),或提供范围。

    # Combines 2 slices
    frame[2,3]==0000 
    
    # From byte position 2 include 2 bytes (e.g. 2 and 3)
    frame[2:2]==0000
    
    # Provides byte range 2 through 3
    frame[2-3]==0000
    

    以下语法控制切片:

    来源:https://www.wireshark.org/docs/man-pages/wireshark-filter.html

    [i:j]    i = start_offset, j = length
    [i-j]    i = start_offset, j = end_offset, inclusive.
    [i]      i = start_offset, length = 1
    [:j]     start_offset = 0, length = j
    [i:]     start_offset = i, end_offset = end_of_field
    

    【讨论】:

      【解决方案2】:

      使用此过滤器:

      data[3:2] == 00:00  # start from 22,get 2 byte equal to 00:00
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2017-04-04
        • 1970-01-01
        • 2012-07-11
        • 2019-04-26
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多