Wireshark启发式解剖器解码作为数据包的一部分

我写了一个Ixia Lua解剖器。我遇到了其他类似解剖器的同样的问题。

是的,我知道已经有一个用C语言编写的解剖器,但至少对于我的跟踪它不起作用 - 我也尝试了"固定以太网尾长度"提出的解决方法,长度为19。可能是因为我的数据包被隧道化,所以我有2个以太网层。

我成功解析了Ixia追踪器。

我的问题是我的解剖器解析了eth_trailer的crc

加入了代码后,crc现在出现在ixia层之前,而不是以太网层树下。是否有可能像没有ixia的数据包一样在以太网层下显示crc?

if offset_ixia == 4 then
    local subtree = tree:add(ixia_trailer_proto, buffer(0,offset_ixia),"eth.trailer")
end

local subtree = tree:add(ixia_trailer_proto, buffer(offset_ixia,length-offset_ixia),"Ixia trailer")

以太网尾crc之前的ixia

在常规数据包中,它看起来像以下内容:

输入图像描述

这是用于显示问题的完整简化代码:

ixia_trailer_proto = Proto("ixia_trailer","Ixia-lua Trailer")

-- Header fields
source = ProtoField.uint8("ixia_trailer_proto.source"    , "源"    , base.HEX)
ixia_trailer_proto.fields = {source}
offset_ixia = 0

-- create a function to dissect it
local function is_ixia_trailer(buffer,pinfo,tree)
    local length = buffer:len()
    --eth + ip
    if length < 15 then return false end
    if length == 15 then
        type_offset = 11
    elseif length == 19 then -- 15 + crc size
        type_offset = 15
        offset_ixia = 4
    end
    local type = buffer( type_offset , 2):uint()
    if type == 0xaf12 then
        ixia_trailer_proto.dissector(buffer, pinfo, tree)
        return true
    end

    return false
end

function ixia_trailer_proto.dissector(buffer, pinfo, tree)
    length = buffer:len()

    if offset_ixia == 4 then
        local subtree = tree:add(ixia_trailer_proto, buffer(0,offset_ixia),"eth.trailer")
    end

    local subtree = tree:add(ixia_trailer_proto, buffer(offset_ixia,length-offset_ixia),"Ixia trailer")

    subtree:add(source, buffer(offset_ixia + 0,1))
end

ixia_trailer_proto:register_heuristic("eth.trailer", is_ixia_trailer)

这是带有追踪器的pcap文件示例https://transfernow.net/019rp7t214kv

点赞