aboutsummaryrefslogtreecommitdiff
path: root/bin/wireshark.lua
diff options
context:
space:
mode:
Diffstat (limited to 'bin/wireshark.lua')
-rw-r--r--bin/wireshark.lua77
1 files changed, 77 insertions, 0 deletions
diff --git a/bin/wireshark.lua b/bin/wireshark.lua
new file mode 100644
index 000000000..273355c20
--- /dev/null
+++ b/bin/wireshark.lua
@@ -0,0 +1,77 @@
1-- declare our protocol
2gwlan_proto = Proto("gnunet","Gnunet Layer")
3-- create a function to dissect it
4local f = gwlan_proto.fields
5
6f.len = ProtoField.uint16 ("gnunet.len", "Gnunet Message Len")
7f.type = ProtoField.uint16 ("gnunet.type", "Gnunet Message Type")
8-- rhs_proto.fields.sequence = ProtoField.uint16("rhs.sequence","Sequence number")
9f.proto = DissectorTable.new("gnunet.proto", "Gnunet Protocoll", FT_UINT16, BASE_DEC)
10--gwlan_proto.fields = {f_len, f_type}
11
12function gwlan_proto.dissector(buffer,pinfo,tree)
13 pinfo.cols.protocol = "Gnunet Packet"
14 local subtree = tree:add(gwlan_proto, buffer(),"Gnunet Data (" .. buffer:len() .. ")")
15 local len = buffer(0,2)
16 local type = buffer(2,2)
17 subtree:add(buffer(0,2), "Len: " .. buffer(0,2):uint())
18 subtree:add(buffer(2,2), "Type: " .. buffer(2,2):uint())
19 if (len:uint() > 5) then
20 if (len:uint() <= buffer:len()) then
21 f.proto:try(type:uint(), buffer(0, len:uint()):tvb(), pinfo, subtree)
22 end
23 if (len:uint() < buffer:len()) then
24 gwlan_proto.dissector(buffer(len:uint(),buffer:len() - len:uint()):tvb(),pinfo,tree)
25 end
26 end
27end
28
29function gwlan_proto.init()
30end
31
32-- load the udp.port table
33llc_table = DissectorTable.get("llc.dsap")
34-- register our protocol to handle llc.dsap 0x1e
35llc_table:add(31,gwlan_proto)
36
37fragmentack = Proto("gnunet.fragmentack","Gnunet Fragment Ack")
38
39function fragmentack.dissector(buffer,pinfo,tree)
40 pinfo.cols.protocol = "Gnunet Fragment ack"
41 tree:add(fragment,buffer(),"Gnunet Data ack")
42 tree:add(buffer(4,4),"fragment_id: " .. buffer(4,4):uint())
43 tree:add(buffer(8,12),"bits: " .. buffer(8,12):uint())
44end
45
46fragment = Proto("gnunet.fragment","Gnunet Fragment")
47
48function fragment.dissector(buffer,pinfo,tree)
49 pinfo.cols.protocol = "Gnunet Fragment"
50 tree:add(fragment,buffer(),"Gnunet Fragment")
51 tree:add(buffer(4,4),"fragment_id: " .. buffer(4,4):uint())
52 tree:add(buffer(8,2),"total_size: " .. buffer(8,2):uint())
53 tree:add(buffer(10,2),"offset: " .. buffer(10,2):uint())
54 tree:add(buffer(12), "Data: " .. buffer(12))
55end
56
57hello = Proto("gnunet.hello","Gnunet Hello Message")
58
59function hello.dissector(buffer,pinfo,tree)
60 pinfo.cols.protocol = "Gnunet Hello Message"
61 tree:add(fragment,buffer(),"Gnunet Hello Message")
62 tree:add(buffer(4,4),"reserved: " .. buffer(4,4):uint())
63 RsaPublicKeyBinaryEncoded(buffer(8 , buffer:len() -8):tvb(),pinfo, tree)
64end
65
66
67function RsaPublicKeyBinaryEncoded(buffer,pinfo,tree)
68 local subtree = tree:add(gwlan_proto,buffer(),"Gnunet RsaPublicKeyBinaryEncoded(" .. buffer:len() .. ")")
69 subtree:add(buffer(0,2),"len: " .. buffer(0,2):uint())
70 subtree:add(buffer(2,2),"sizen: " .. buffer(2,2):uint())
71 subtree:add(buffer(4,258),"Pub Key: " .. buffer(4,258))
72 subtree:add(buffer(262,2),"pedding: " .. buffer(262,2):uint())
73end
74
75f.proto:add(19,fragmentack)
76f.proto:add(18,fragment)
77f.proto:add(16,hello)