diff options
author | David Brodski <david@brodski.eu> | 2011-10-26 00:01:04 +0000 |
---|---|---|
committer | David Brodski <david@brodski.eu> | 2011-10-26 00:01:04 +0000 |
commit | f8473f9b393e7c8ebebbbcd11ffd89de5f4cf1cb (patch) | |
tree | f431a1c8180921197c08744172f10e0320c549c4 /bin | |
parent | e79ca91c1884398d2ba205026d168be375e74788 (diff) | |
download | gnunet-f8473f9b393e7c8ebebbbcd11ffd89de5f4cf1cb.tar.gz gnunet-f8473f9b393e7c8ebebbbcd11ffd89de5f4cf1cb.zip |
wireshark lua file, at the moment only for wlan
Diffstat (limited to 'bin')
-rw-r--r-- | bin/wireshark.lua | 77 |
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 | ||
2 | gwlan_proto = Proto("gnunet","Gnunet Layer") | ||
3 | -- create a function to dissect it | ||
4 | local f = gwlan_proto.fields | ||
5 | |||
6 | f.len = ProtoField.uint16 ("gnunet.len", "Gnunet Message Len") | ||
7 | f.type = ProtoField.uint16 ("gnunet.type", "Gnunet Message Type") | ||
8 | -- rhs_proto.fields.sequence = ProtoField.uint16("rhs.sequence","Sequence number") | ||
9 | f.proto = DissectorTable.new("gnunet.proto", "Gnunet Protocoll", FT_UINT16, BASE_DEC) | ||
10 | --gwlan_proto.fields = {f_len, f_type} | ||
11 | |||
12 | function 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 | ||
27 | end | ||
28 | |||
29 | function gwlan_proto.init() | ||
30 | end | ||
31 | |||
32 | -- load the udp.port table | ||
33 | llc_table = DissectorTable.get("llc.dsap") | ||
34 | -- register our protocol to handle llc.dsap 0x1e | ||
35 | llc_table:add(31,gwlan_proto) | ||
36 | |||
37 | fragmentack = Proto("gnunet.fragmentack","Gnunet Fragment Ack") | ||
38 | |||
39 | function 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()) | ||
44 | end | ||
45 | |||
46 | fragment = Proto("gnunet.fragment","Gnunet Fragment") | ||
47 | |||
48 | function 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)) | ||
55 | end | ||
56 | |||
57 | hello = Proto("gnunet.hello","Gnunet Hello Message") | ||
58 | |||
59 | function 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) | ||
64 | end | ||
65 | |||
66 | |||
67 | function 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()) | ||
73 | end | ||
74 | |||
75 | f.proto:add(19,fragmentack) | ||
76 | f.proto:add(18,fragment) | ||
77 | f.proto:add(16,hello) | ||