Skip to content

Instantly share code, notes, and snippets.

@piense
Created April 9, 2020 02:00
Show Gist options
  • Save piense/d4247a88500eda06e2ab68a2fc617f1f to your computer and use it in GitHub Desktop.
Save piense/d4247a88500eda06e2ab68a2fc617f1f to your computer and use it in GitHub Desktop.
A&H IP Lua dissector
-- Place this in %APPDATA%\Wireshark\plugins
-- declare our protocol
IP8 = Proto("IP8","IP8")
-- create a function to dissect it
function IP8.dissector(buffer,pinfo,tree)
pinfo.cols.protocol = "IP8"
local subtree = tree:add(IP8,buffer(),"IP8 Protocol Data")
offset = 0
while offset < buffer:len() - 3 do
found = false
if buffer(offset+0,3):uint() == 0xf00001 then
subtree:add(buffer(offset+0,3),"IP8 Header" )
subtree:add(buffer(offset+3,7),"Parameter 0x".. buffer(offset+3,7))
if buffer(offset+3,3):uint() == 0x277400 and buffer(offset+7,1):uint() == 0x11 then
subtree:add(buffer(offset+6,1),"Channel #" .. "" .. (buffer(offset+6,1):uint() - 0x30).." Fader")
subtree:add(buffer(offset+12,1),"Fader value: " .. buffer(offset+12,1):uint())
end
if buffer(offset+3,3):uint() == 0x277400 and buffer(offset+7,1):uint() == 0x10 then
subtree:add(buffer(offset+6,1),"Channel #" .. "" .. (buffer(offset+6,1):uint() - 0x01).." Mute Button")
subtree:add(buffer(offset+11,1),"Button state: " .. buffer(offset+11,1):uint())
end
subtree:add(buffer(offset+10,1),"Data Length: " .. buffer(offset+10,1):uint())
if buffer(offset+10,1):uint() == 0 then
subtree:add(buffer(offset+10,1),"Data length 0 so this is a request for the data")
end
found = true
end
if not found then
offset = offset + 1
else
offset = offset + buffer(offset+10,1):uint() + 12
end
end
end
-- load the tcp.port table
tcp_table = DissectorTable.get("tcp.port")
-- register our protocol to handle tcp port 51321
tcp_table:add(51321,IP8)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment