packetgen 1.4.2 → 1.4.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/packetgen/header/dot11/sub_mngt.rb +11 -0
- data/lib/packetgen/packet.rb +17 -3
- data/lib/packetgen/pcapng/epb.rb +1 -0
- data/lib/packetgen/pcapng/file.rb +1 -0
- data/lib/packetgen/pcapng/idb.rb +1 -0
- data/lib/packetgen/pcapng/shb.rb +1 -0
- data/lib/packetgen/pcapng/spb.rb +1 -0
- data/lib/packetgen/pcapng/unknown_block.rb +1 -0
- data/lib/packetgen/pcapng.rb +1 -0
- data/lib/packetgen/types/tlv.rb +2 -2
- data/lib/packetgen/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4b5b7c4c6b94e7e5e2323d99a06f687109495539
|
4
|
+
data.tar.gz: 363abe5a21f82d8f0fe8f791912109c55d795218
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7782f886a780d71bd9e976bb9185742979f8a5d0a4818a07a9b8c249d4628616db690a4620e80a346ec19357df288c4d2b598804095b648e1373cf9f99c15a73
|
7
|
+
data.tar.gz: e8838e0e6ba458472090661066cdd90ac4358f02e4eea53adf4c2c09867ee83c0e4c318241a30f0cb255d91cf393319002b378c174161744596b2bd2f84e2e2d
|
@@ -59,6 +59,7 @@ module PacketGen
|
|
59
59
|
end
|
60
60
|
|
61
61
|
# IEEE 802.11 Association Request frame
|
62
|
+
# @author Sylvain Daubert
|
62
63
|
class AssoReq < SubMngt
|
63
64
|
# @!attribute cap
|
64
65
|
# @return [Integer] 16-bit capabillities word
|
@@ -71,6 +72,7 @@ module PacketGen
|
|
71
72
|
Management.bind_header AssoReq, op: :and, type: 0, subtype: 0
|
72
73
|
|
73
74
|
# IEEE 802.11 Association Response frame
|
75
|
+
# @author Sylvain Daubert
|
74
76
|
class AssoResp < SubMngt
|
75
77
|
# @!attribute cap
|
76
78
|
# @return [Integer] 16-bit capabillities word
|
@@ -86,6 +88,7 @@ module PacketGen
|
|
86
88
|
Management.bind_header AssoResp, op: :and, type: 0, subtype: 1
|
87
89
|
|
88
90
|
# IEEE 802.11 ReAssociation Request frame
|
91
|
+
# @author Sylvain Daubert
|
89
92
|
class ReAssoReq < AssoReq
|
90
93
|
# @!attribute current_ap
|
91
94
|
# @return [Eth::MAcAddr]
|
@@ -95,18 +98,21 @@ module PacketGen
|
|
95
98
|
Management.bind_header ReAssoReq, op: :and, type: 0, subtype: 2
|
96
99
|
|
97
100
|
# IEEE 802.11 ReAssociation Response frame
|
101
|
+
# @author Sylvain Daubert
|
98
102
|
class ReAssoResp < AssoResp
|
99
103
|
end
|
100
104
|
Header.add_class ReAssoResp
|
101
105
|
Management.bind_header ReAssoResp, op: :and, type: 0, subtype: 3
|
102
106
|
|
103
107
|
# IEEE 802.11 Probe Request frame
|
108
|
+
# @author Sylvain Daubert
|
104
109
|
class ProbeReq < SubMngt
|
105
110
|
end
|
106
111
|
Header.add_class ProbeReq
|
107
112
|
Management.bind_header ProbeReq, op: :and, type: 0, subtype: 4
|
108
113
|
|
109
114
|
# IEEE 802.11 Probe Response frame
|
115
|
+
# @author Sylvain Daubert
|
110
116
|
class ProbeResp < SubMngt
|
111
117
|
# @!attribute timestamp
|
112
118
|
# @return [Integer] 64-bit timestamp
|
@@ -122,6 +128,7 @@ module PacketGen
|
|
122
128
|
Management.bind_header ProbeResp, op: :and, type: 0, subtype: 5
|
123
129
|
|
124
130
|
# IEEE 802.11 Beacon frame
|
131
|
+
# @author Sylvain Daubert
|
125
132
|
class Beacon < SubMngt
|
126
133
|
# @!attribute timestamp
|
127
134
|
# @return [Integer] 64-bit timestamp
|
@@ -137,11 +144,13 @@ module PacketGen
|
|
137
144
|
Management.bind_header Beacon, op: :and, type: 0, subtype: 8
|
138
145
|
|
139
146
|
# IEEE 802.11 ATIM frame
|
147
|
+
# @author Sylvain Daubert
|
140
148
|
class ATIM < SubMngt; end
|
141
149
|
Header.add_class ATIM
|
142
150
|
Management.bind_header ATIM, op: :and, type: 0, subtype: 9
|
143
151
|
|
144
152
|
# IEEE 802.11 Disassociation frame
|
153
|
+
# @author Sylvain Daubert
|
145
154
|
class Disas < SubMngt
|
146
155
|
# @!attribute reason
|
147
156
|
# @return [Integer] 16-bit reason value
|
@@ -151,6 +160,7 @@ module PacketGen
|
|
151
160
|
Management.bind_header Disas, op: :and, type: 0, subtype: 10
|
152
161
|
|
153
162
|
# IEEE 802.11 Authentication frame
|
163
|
+
# @author Sylvain Daubert
|
154
164
|
class Auth < SubMngt
|
155
165
|
# @!attribute algo
|
156
166
|
# @return [Integer] 16-bit algo value
|
@@ -166,6 +176,7 @@ module PacketGen
|
|
166
176
|
Management.bind_header Auth, op: :and, type: 0, subtype: 11
|
167
177
|
|
168
178
|
# IEEE 802.11 Deauthentication frame
|
179
|
+
# @author Sylvain Daubert
|
169
180
|
class DeAuth < SubMngt
|
170
181
|
# @!attribute reason
|
171
182
|
# @return [Integer] 16-bit reason value
|
data/lib/packetgen/packet.rb
CHANGED
@@ -43,6 +43,8 @@ module PacketGen
|
|
43
43
|
#
|
44
44
|
# == Save packets to a file
|
45
45
|
# Packet.write 'file.pcapng', packets
|
46
|
+
#
|
47
|
+
# @author Sylvain Daubert
|
46
48
|
class Packet
|
47
49
|
# @return [Array<Header::Base]
|
48
50
|
attr_reader :headers
|
@@ -91,11 +93,23 @@ module PacketGen
|
|
91
93
|
|
92
94
|
# Read packets from +filename+.
|
93
95
|
#
|
94
|
-
# For more control, see {PcapNG::File}.
|
95
|
-
# @param [String] filename PcapNG file
|
96
|
+
# For more control, see {PcapNG::File} or {PCAPRUB::Pcap}.
|
97
|
+
# @param [String] filename PcapNG or Pcap file.
|
96
98
|
# @return [Array<Packet>]
|
99
|
+
# @author Sylvain Daubert
|
100
|
+
# @author Kent Gruber
|
97
101
|
def self.read(filename)
|
98
|
-
|
102
|
+
begin
|
103
|
+
PcapNG::File.new.read_packets filename
|
104
|
+
rescue => e
|
105
|
+
raise ArgumentError, e unless File.extname(filename.downcase) == '.pcap'
|
106
|
+
packets = []
|
107
|
+
PCAPRUB::Pcap.open_offline(filename).each_packet do |packet|
|
108
|
+
next unless packet = PacketGen.parse(packet.to_s)
|
109
|
+
packets << packet
|
110
|
+
end
|
111
|
+
packets
|
112
|
+
end
|
99
113
|
end
|
100
114
|
|
101
115
|
# Write packets to +filename+
|
data/lib/packetgen/pcapng/epb.rb
CHANGED
data/lib/packetgen/pcapng/idb.rb
CHANGED
data/lib/packetgen/pcapng/shb.rb
CHANGED
data/lib/packetgen/pcapng/spb.rb
CHANGED
data/lib/packetgen/pcapng.rb
CHANGED
@@ -8,6 +8,7 @@ module PacketGen
|
|
8
8
|
|
9
9
|
# Module to handle PCAP-NG file format.
|
10
10
|
# See http://xml2rfc.tools.ietf.org/cgi-bin/xml2rfc.cgi?url=https://raw.githubusercontent.com/pcapng/pcapng/master/draft-tuexen-opsawg-pcapng.xml&modeAsFormat=html/ascii&type=ascii
|
11
|
+
# @author Sylvain Daubert
|
11
12
|
module PcapNG
|
12
13
|
|
13
14
|
# Section Header Block type number
|
data/lib/packetgen/types/tlv.rb
CHANGED
@@ -65,9 +65,9 @@ module PacketGen
|
|
65
65
|
self.old_type = val
|
66
66
|
else
|
67
67
|
unless has_human_types?
|
68
|
-
raise TypeError,
|
68
|
+
raise TypeError, 'need an Integer'
|
69
69
|
end
|
70
|
-
new_val = self.class::TYPES
|
70
|
+
new_val = self.class::TYPES.key(val.to_s)
|
71
71
|
raise ArgumentError, "unknown #{val.to_s} type" if new_val.nil?
|
72
72
|
self.old_type = new_val
|
73
73
|
end
|
data/lib/packetgen/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: packetgen
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sylvain Daubert
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-06-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pcaprub
|