-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathleep.lua
More file actions
50 lines (36 loc) · 1.26 KB
/
leep.lua
File metadata and controls
50 lines (36 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
print("Loading LEEP...")
local leep = Proto("leep", "LBNL Embedded Ethernet Protocol")
local header = ProtoField.uint64("leep.header", "Header", base.HEX)
local cmd = ProtoField.uint8("leep.cmd", "Command", base.HEX, {[0]="Write",[1]="Read"}, 0x10)
local addr = ProtoField.uint24("leep.addr", "Address", base.HEX)
local data = ProtoField.uint32("leep.data", "Data", base.HEX)
local junk = ProtoField.bytes("leep.junk", "Junk")
leep.fields = {header, cmd, addr, data, junk}
function leep.dissector (buf, pkt, root)
pkt.cols.protocol = leep.name
pkt.cols.info:clear()
pkt.cols.info:append(pkt.src_port.."->"..pkt.dst_port.." ")
local tree = root:add(leep, buf)
if buf:len()<32
then
pkt.cols.info:append("Invalid (Truncated?)")
return
end
pkt.cols.info:append(string.format("Header %08x %08x %06x",
buf(0,4):uint(), buf(4,4):uint(), buf(9,3):uint()))
tree:add(header, buf(0,8))
buf = buf(8):tvb()
while buf:len()>=8
do
tree:add(cmd, buf(0,1))
tree:add(addr, buf(1,3))
tree:add(data, buf(4,4))
buf = buf(8):tvb()
end
if buf:len()>0
then
tree:add(junk, buf(0))
end
end
local utbl = DissectorTable.get("udp.port")
utbl:add(50006, leep)