jo_*_*man 4 lua tcp wireshark-dissector
我有一个解析器,它运行在TCP协议之上,并且具有在多个TCP数据包上流动的数据.
我想在转换所有内容之前汇编数据,所以我理解我需要tcp_dissect_pdus()它,但我找不到它的文档或示例.
任何人都可以指导我或帮助我理解我如何使用它吗?
tcp_dissect_pdus没有wslua API.但你可以自己实现它.
如果你想组装跨越两个或更多数据包的pdu,那就相当简单了:
function slicer.dissector(tvb, pinfo, tree)
...
local pdu_length = get_pdu_length(...)
if pdu_length > tvb:len() then
pinfo.desegment_len = pdu_length - tvb:len()
else
do_dissection(tvb, pifo, tree)
end
return
end
Run Code Online (Sandbox Code Playgroud)
如果您不知道pdu的确切长度,您可以这样做:
pinfo.desegment_len = DESEGMENT_ONE_MORE_SEGMENT
Run Code Online (Sandbox Code Playgroud)
您应该阅读README.developer第2.7节.