标签: protofield

如何为 Lua Wireshark Dissector 创建 Protofield 子阵列

给出以下示例:

local f= mycoolprotocol.fields
f.Length = ProtoField.uint32("MCP.Length","Length",base.DEC)
f.MsgType = ProtoField.uint16("MCP.MsgType","MsgType",base.DEC)
Run Code Online (Sandbox Code Playgroud)

我已经声明了 2 个 Protofields。但想象一下,我有一个重复的组或一组项目:

消息正文如下所示:

struct person
{
  int16 age;
  string name;
}
person[] p = new person[2];
Run Code Online (Sandbox Code Playgroud)

理想情况下,我想在 Wireshark 中为该组创建一个子树

+ Persons
 + Person1
    name
    age
 + Person2
    name
    age
Run Code Online (Sandbox Code Playgroud)

问题是我不知道如何在 Lua 中构建它。这声明了2个protofields:

f.name = Protofield.string("MCP.name","name","Text")
f.age = ProtoField.uint16("MCP.age","age",base.DEC)
Run Code Online (Sandbox Code Playgroud)

但我想改为创建组的动态数组,所以我可以这样做:

subtree:add_le( f[0].name, buffer(x,y)) 
Run Code Online (Sandbox Code Playgroud)

那么,有Protofield.ProtoFieldArray吗?是否可以?欢迎任何其他想法。

谢谢。

另外,作为参考:http : //ask.wireshark.org/questions/28038/how-to-create-a-protofield-sub-array-in-lua

lua wireshark wireshark-dissector protofield

2
推荐指数
1
解决办法
2107
查看次数

标签 统计

lua ×1

protofield ×1

wireshark ×1

wireshark-dissector ×1