How to change the info column in a protobuf dissector.
I've written a simple protobuf dissector that triggers on our custom ppi field in the protobuf. Traffic is over SCTP, and it's modeled on the UDP parts of the tutorial protobuf dissector. It works well enough, and correctly parses and resolves all the various nested structures.
I don't care for the default value of the info column in wireshark, though, and would like to set it to a custom value derived from field values in some of the nested structures. Various AI chats have suggested things like local pb_tree = pinfo.private["pb_tree"]
and local submsg = subtree:field("field_name1")
after pcall(Dissector.call, protobuf_dissector, tvb, pinfo, subtree)
to get access to those nested structures, but I've been unable to make those work - they are either nil, or contain nothing of the protobuf message.
Is the protobuf parser able to return a tree to me that I can peruse for the values I want?
As an example, if the dissected view in Wireshark looked like this:
IPM
Protocol Buffers: cmn.msg.Msg (Message: cmn.msg.Msg)
src: (65 bytes) (Message: cmn.Addr)
job: ABC (1)
dest: (65 bytes) (Message: cmn.Addr)
job: XYZ (2)
task: (2 bytes) (Message: cmn.ipm.task_ipm)
event: SYS_EV_SEND_DATA (100)
I'd want to populate the info column with ABC -> XYZ: SYS_EV_SEND_DATA
. (There are many other fields in those sections, but those are irrelevant to this problem.) It's further complicated because there could be multiples of the src
and dest
, but I think I have a handle on that, if I can get access to the protobuf tree.
This is done as a post dissector (EASYPOST.lua) but try it with your dissector.
Here using a field from the UDP addressbook example.
To get the formatted strings like
ABC
,XYZ
andSYS_EV_SEND_DATA
:Produces
63334 → 8127 Len=128 (PROTOBUF) people people HOME HOME WORK
for ...(more)