Lua - 可以用ProtoField定义结构吗?

时间:2015-03-20 16:55:22

标签: lua wireshark

我正在尝试编写自己的解剖器。 我读到了:

1http://www.lua.org/manual/5.1/以及CSjark文档的Unknown structs handling部分。

我没有找到一种方法将ProtoField与结构一起使用:

例如,我想为以下ICD编写解剖器:

int32 syncWord
int16 size
int16 num_of_structs

strcut_1
strcut_2
....
struct_n

其中Struct有以下成员:

int32 x
int32 y
int32 z

构建消息时我可以写:

msg.syncWord= ProtoField.int32 ("myproto.syncWord", "syncWord")
msg.size= ProtoField.int16 ("myproto.size", "size")
msg.num_of_structs= ProtoField.int16 ("myproto.num_of_structs", "num_of_structs")

我的问题是如何添加结构? 有方便吗? (或者只是一次又一次地复制结构域?) 我找不到ProtoField的任何结构成员...... 有什么建议吗?

1 个答案:

答案 0 :(得分:0)

在ask.wireshark.org中被问到了类似的问题:https://ask.wireshark.org/questions/28038/how-to-create-a-protofield-sub-array-in-lua

你可以阅读(Wireshark的第10章Lua支持)Wireshark解剖器开发的文档,你可能会在那里找到一些好的建议:https://www.wireshark.org/docs/wsdg_html_chunked/wslua_dissector_example.html

相关问题