Hello, We are trying to create a chained dissector in LUA (as described in Wireshark wiki page) but we are not able to get a reference to existing heuristic dissector ! :( For "normal" (= non-heuristic) dissector, it works fine. In our case, we try to wrap RTPS (Real-Time Publish-Subscribe) protocol. We looked at source code (in epan/dissectors/packet-rtps.c) and we think we are using expected name. Unfortunately, with Wireshark v2.2.7, we are not able to get UDP heuristic dissector table, nor RTPS dissector. It seems that DissectorTable.get() is only used for "normal" dissector (it triggers an error for heuristic "udp" but not for normal "udp.port"). And Dissector.get("rtps") fails too: no such dissector. But Dissector.get("rtitcp") works fine. We can notice that RTPS is not contained in Dissector.list(). Q1) what are we missing ? Q2) is it a bug in Wireshark ? Thanks for your help, Contrib asked 07 Jun '17, 07:11 Lua Hobbyist |
2 Answers:
The Wireshark Lua Examples wiki page provides a dissector.lua file written by Hadriel Kaplan that illustrates how to register a heuristic Lua dissector with UDP, namely:
answered 07 Jun '17, 07:54 cmaynard ♦♦ |
Replying to my own questions: it seems there are limitations in current Wireshark LUA API
Concerning RTPS, a workaround to first previous limitation is below: (/!\ need to patch source code + recompile) wireshark-2.2.7_RTPS_registration_for_LUA_access.patch
Thanks to previous patch, we are able to get access to original RTPS dissector in LUA script thanks to There is still the second limitation: this time, a workaround is to use UDP dissector table and register the new wrapper to a specific UDP port. answered 11 Jun ‘17, 14:54 Lua Hobbyist Previous patch has been submitted, see: https://code.wireshark.org/review/#/c/22137/ (14 Jun ‘17, 13:47) Lua Hobbyist |
@cmaynard Thanks, but we already found this example.
You may have been confused by the title (and my "poor" english, sorry ^_^): here, "reference" stands for LUA (runtime) object, not for documentation pointer.
But as described in my previous post, we need to wrap (aka create a "chained dissector" for) an existing protocol (here: RTPS). In order to do so, we need to:
Unfortunately, our problem is the first step: based on LUA API, it seems there are 2 ways to get original dissector:
DissectorTable.get()
) then get existing dissector thanks todtbl:get_dissector()
Dissector.get()
It turns out that in our case, with RTPS protocol, both ways return an error ! :(
We checked that in Wireshark GUI menu:
View
->Internals
->Dissector Tables
, RTPS protocol is contained in UDP'sHeuristic Table
(and nowhere else). Consequently, following 1st way, we would need to be able to get UDP heuristic dissector table in LUA script, butDissectorTable.get("udp")
triggers an error. It seems that this function should only be used for "normal" dissector, one registered to a fix port for example (so not heuristic). We also checked that"udp"
is present inDissectorTable.heuristic_list()
but it should only be used withProto:register_heuristic()
and so we can not access to original RTPS dissector.Following 2nd way, we tried to call
Dissector.get("rtps")
but here again, an error is triggered:no such dissector
. We noticed that"rtps"
is not present inDissector.list()
and it seems weird.Then, we looked at source code: wireshark-2.2.7/epan/dissectors/packet-rtps.c#L11544 and we noticed another protocol implemented alongside RTPS:
"rtitcp"
. It turns out that"rtitcp"
is present inDissector.list()
and call toDissector.get("rtitcp")
works fine (no error contrary to"rtps"
).Consequently, it seems that
"rtps"
protocol implementation missed something compare to"rtitcp"
. In order to be able to access to original dissector in LUA, we may need to register it to a fix (dummy) port ? or add a new function in LUA API in order to get a heuristic dissector ?Or maybe there is a 3rd way to get existing dissector ?