diff options
author | Jan Huwald <jh@sotun.de> | 2013-06-26 15:47:13 (GMT) |
---|---|---|
committer | Jan Huwald <jh@sotun.de> | 2013-06-26 15:47:13 (GMT) |
commit | a3cf7f25cd74cd328dcdeb56869102906253abb2 (patch) | |
tree | 9ae82836a20e97906d385ca7c6badbebb306b44a /wireshark | |
parent | e32c8605be4c7eda35c4e5ce6ff5c47ac37b9098 (diff) |
Diffstat (limited to 'wireshark')
-rw-r--r-- | wireshark/hbbp_dissector.lua | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/wireshark/hbbp_dissector.lua b/wireshark/hbbp_dissector.lua index 73316f5..ca58d35 100644 --- a/wireshark/hbbp_dissector.lua +++ b/wireshark/hbbp_dissector.lua @@ -1,24 +1,22 @@ -hbbp_proto = Proto("hbbp","Home Brew Broadcast Protocol") +hbbp_proto = Proto("hbbp", "Home Brew Broadcast Protocol") + -- create a function to dissect it -function hbbp_proto.dissector(buffer,pinfo,tree) +function hbbp_proto.dissector(buffer, pinfo, tree) pinfo.cols.protocol = "HBBP" - local subtree = tree:add(hbbp_proto,buffer(),"HBBP Data") - + local subtree = tree:add(hbbp_proto, buffer(), "HBBP Data") + + -- find the \0 that seperates task and payload local i = 0 local b = buffer():bytes() - - while (i<b:len() and b:get_index(i)~=0) do + while i < b:len() and b:get_index(i) ~= 0 do i = i + 1 end - if i==0 then - return (nil) - end - subtree:add(buffer(0,i),"Task: " .. buffer(0,i):string()) + + subtree:add(buffer(0, i), "Task: " .. buffer(0, i):string()) if b:get_index(i) == 0 then - subtree:add(buffer(i+1),"Payload: [Length " .. buffer:len()-i .. "]") + subtree:add(buffer(i + 1),"Payload [Length " .. buffer:len() - i .. "]") end end --- load the udp.port table -udp_table = DissectorTable.get("udp.port") + -- register our protocol to handle udp port 4950 -udp_table:add(4950,hbbp_proto)
\ No newline at end of file +DissectorTable.get("udp.port"):add(4950, hbbp_proto)
\ No newline at end of file |