From e2a43526597bcd9fea7e324fed2119eb4d4e3356 Mon Sep 17 00:00:00 2001 From: David Ventura Date: Wed, 1 May 2024 10:47:00 +0200 Subject: [PATCH] add heuristic packet matcher --- dissector.lua | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/dissector.lua b/dissector.lua index 13d6cbb..0929aad 100644 --- a/dissector.lua +++ b/dissector.lua @@ -151,5 +151,15 @@ function ilnk_proto.dissector(buffer, pinfo, tree) -- subtree:add(ilnk_proto.fields.payload, buffer(2, packet_length-2)) end -udp_table = DissectorTable.get("udp.port"):add(50563, ilnk_proto) +local function heuristic_checker(buffer, pinfo, tree) + length = buffer:len() + if length < 2 then return false end + local packetname = lut[buffer(0, 2):uint()] + if packetname ~= nil then + ilnk_proto.dissector(buffer, pinfo, tree) + return true + end + return false +end udp_table2 = DissectorTable.get("udp.port"):add(32108, ilnk_proto) +h = ilnk_proto:register_heuristic("udp", heuristic_checker)