123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- -- protocol dissector for EcoPlugs protocol
-
- -- declare our protocol
- eocProt = Proto("EP","EcoPlugs IoT")
-
- -- create a function to dissect it
- function eocProt.dissector(buffer,pinfo,tree)
- pinfo.cols.protocol = "EP"
- local protocolTree = tree:add(eocProt, buffer(), "EcoPlugs Protocol Data")
-
- if buffer:len() == 408 then
- -- this is a broadcast packet response
- protocolTree:add(buffer(4,6), "Version: " .. buffer(4,6):stringz())
- protocolTree:add(buffer(10,32), "ID: " .. buffer(10,32):stringz())
- protocolTree:add(buffer(42,32), "Name: " .. buffer(42,32):stringz())
- protocolTree:add(buffer(74,32), "Short ID: ".. buffer(74,32):stringz())
- protocolTree:add(buffer(106,14), "Time: " .. buffer(106,14))
- protocolTree:add(buffer(252,8), "Region: " .. buffer(252,8):stringz())
- protocolTree:add(buffer(260,5), "Zip Code: " .. buffer(260,5):stringz())
- ipl = protocolTree:add(buffer(272,48), "Cloud IP Addresses")
- ipl:add(buffer(272,16), "Cloud IP 1: " .. buffer(272,16):stringz())
- ipl:add(buffer(288,16), "Cloud IP 2: " .. buffer(288,16):stringz())
- ipl:add(buffer(304,16), "Cloud IP 3: " .. buffer(304,16):stringz())
- protocolTree:add(buffer(368,18), "Device MAC Address: " .. buffer(368,18):stringz())
- protocolTree:add(buffer(386,18), "Host: " .. buffer(386,18):stringz())
- else
- -- this is a query/set command
- protocolTree:add(buffer(0,6), "Command: " .. buffer(0,6))
- protocolTree:add(buffer(6,4), "Model: " .. buffer(6,4))
- protocolTree:add(buffer(10,6), "Version: " .. buffer(10,6):stringz())
- protocolTree:add(buffer(16,32), "ID: " .. buffer(16,32):stringz())
- protocolTree:add(buffer(48,32), "Name: " .. buffer(48,32):stringz())
- protocolTree:add(buffer(80,32), "Short ID: ".. buffer(80,32):stringz())
- -- set command here
- if buffer:len() == 130 then
- protocolTree:add(buffer(128,2), "Set Mode: " .. buffer(128,2))
- end
- end
- end
-
- -- load the udp.port table
- udp_table = DissectorTable.get("udp.port")
-
- -- register our protocol to handle udp port 25 and if I could, dest ports of 31423
- udp_table:add(25, eocProt)
|