Wireshark的IEEE 802.15.4 Lua解析器 - 解析表名称是什么?
我正在使用 Lua 编写 Wireshark 分析器,用于分解基于 802.15.4 的自定义协议。很遗憾我无法确定正确的 DissectorTable 名称:
table = DissectorTable.get("wpan") -- wpan 无法使用
table:add(0, myProto) -- 我对此处的第一个参数不确定
我应该使用什么分解器表名称来创建所描述的分解器?并且添加函数的第一个参数应该是什么?
提前感谢您的帮助!
编辑
我发现我必须这样做:
table = DissectorTable.get("wtap_encap")
table:add(104, myProto)
其中 104 代表 802.15.4。
我是通过查看 Wireshark -> Internal -> Dissector Table 找到它的。
原文链接 https://stackoverflow.com/questions/9182943
如果您的协议是基于802.15.4并使用普通的802.15.4数据包,有更好的方法可以做到这一点。上述答案完全使用自定义802.15.4解析器替换802.15.4解析器。但是,802.15.4解析器通过一个名为“wpan.panid”的解析器表公开数据包有效载荷的解析。传递的“pattern”是应使用此解析器的pan id(这并不真正有意义,因为802.15.4 pan id没有分配,但也没关系)。
local foo = Proto("foo", "Foo dissector")
--注册为panid 3的解析器。将自动调用与panid 3的数据包
--选择一个panid是强制性的,请参考https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=10696。
--还可以使用“解码为…”选项手动选择。
table = DissectorTable.get("wpan.panid")
table:add(3, foo)
或者,您可以在“wpan”表中注册启发式解析器,这将针对所有802.15.4有效负载数据包进行调用。类似地,有一个“wpan.beacon”表,用于呼叫信标数据包。
function dissector(tvb, pinfo, tree)
-- Do stuff here
end
foo.dissector = dissector
--注册为启发式解析器,适用于所有wpan数据包的调用。
--我们想在这里传递foo.dissector,但是结果说明
--registoer_heuristic需要一个实际函数。传递代理
--不起作用(因为调用foo.dissector(…)会丢弃
--返回值),所以我们在以上两步中定义解剖者函数,
--因此我们可以在这里直接访问真正的功能。
--另请参阅https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=10695
foo:register_heuristic("wpan", dissector)
以下是相关的源代码:
https://code.wireshark.org/review/gitweb?p=wireshark.git;a=blob;f=epan/dissectors/packet-ieee802154.c;h=6051c84e971a629dc482722f265bb75f83b15259;hb=54aea456331825be6f802edec510e4cb2e6cc34a#l2821) https://code.wireshark.org/review/gitweb?p=wireshark.git;a=blob;f=epan/dissectors/packet-ieee802154.c;h=6051c84e971a629dc482722f265bb75f83b15259;hb=54aea456331825be6f802edec510e4cb2e6cc34a#l1100 https://code.wireshark.org/review/gitweb?p=wireshark.git;a=blob;f=epan/dissectors/packet-ieee802154.c;h=6051c84e971a629dc482722f265bb75f83b15259;hb=54aea456331825be6f802edec510e4cb2e6cc34a#l1085 https://code.wireshark.org/review/gitweb?p=wireshark.git;a=blob;f=epan/dissectors/packet-ieee802154.h;h=02acfd555f1154a469b4e74add2e0e9d04d6c81d;hb=54aea456331825be6f802edec510e4cb2e6cc34a#l29
- 如何在roblox studio中1:1导入真实世界的地形?
- 求解,lua_resume的第二次调用继续执行协程问题。
- 【上海普陀区】内向猫网络招募【Skynet游戏框架Lua后端程序员】
- SF爱好求教:如何用lua实现游戏内调用数据库函数实现账号密码注册?
- Lua实现网站后台开发
- LUA错误显式返回,社区常见的规约是怎么样的
- lua5.3下载库失败
- 请问如何实现文本框内容和某个网页搜索框内容连接,并把网页输出来的结果反馈到另外一个文本框上
- lua lanes多线程使用
- 一个kv数据库
- openresty 有没有比较轻量的 docker 镜像
- 想问一下,有大佬用过luacurl吗
- 在Lua执行过程中使用Load函数出现问题
- 为什么 neovim 里没有显示一些特殊字符?
- Lua比较两个表的值(不考虑键的顺序)
- 有个lua简单的项目,外包,有意者加微信 liuheng600456详谈,最好在成都
- 如何在 Visual Studio 2022 中运行 Lua 代码?
- addEventListener 返回 nil Lua
- Lua中获取用户配置主目录的跨平台方法
- 如何编写 Lua 模式将字符串(嵌套数组)转换为真正的数组?
为了解决这个问题,我最终的解决方案如下:
table = DissectorTable.get("wtap_encap") table:add(104, myProto) table:add(127, myProto)
其中104和127代表802.15.4(见: wireshark -> internals -> dissector table)。