packetgen 2.8.3 → 2.8.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -0
- data/lib/packetgen/header/base.rb +4 -4
- data/lib/packetgen/header/dhcpv6/duid.rb +3 -3
- data/lib/packetgen/header/dhcpv6/option.rb +21 -46
- data/lib/packetgen/header/dot11.rb +2 -2
- data/lib/packetgen/header/eap/fast.rb +1 -4
- data/lib/packetgen/header/eap/md5.rb +2 -6
- data/lib/packetgen/header/eap/tls.rb +1 -5
- data/lib/packetgen/header/eap/ttls.rb +1 -5
- data/lib/packetgen/header/igmpv3.rb +1 -1
- data/lib/packetgen/header/ike/sa.rb +1 -1
- data/lib/packetgen/header/ike/ts.rb +1 -1
- data/lib/packetgen/header/ip.rb +1 -1
- data/lib/packetgen/header/ip/option.rb +5 -5
- data/lib/packetgen/header/ipv6/hop_by_hop.rb +1 -1
- data/lib/packetgen/header/ospfv2/ls_ack.rb +2 -2
- data/lib/packetgen/header/tftp.rb +3 -3
- data/lib/packetgen/types/fields.rb +47 -3
- data/lib/packetgen/types/int_string.rb +2 -2
- data/lib/packetgen/utils.rb +20 -3
- data/lib/packetgen/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bd941670ed94baa729f5ee91da53062195f6764b3e75d7e70cbbc09075adfdc2
|
4
|
+
data.tar.gz: 4e5b3082f9ada7a234fc559baf53f8abb0ab374e76391c938505f82235a2a58a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ebe8bf700763779d708b96bc7731dec2e73b2aa9c23308b9b2f63743c785bc989dfeea01d1b04dba8210f031f6047791151f06a4671b0980bd429becc653403c
|
7
|
+
data.tar.gz: 9243425668eba786664e28a55edb7458b0d51bb27e3ca09ac68573b9d41e0cb5f087fe677f93c5d05aef05ac55adc08220475c643e1da81958259ab07b34407c
|
data/.rubocop.yml
CHANGED
@@ -9,10 +9,10 @@ module PacketGen
|
|
9
9
|
module Header
|
10
10
|
# @abstract Base class for all header types.
|
11
11
|
# Subclasses may define magic methods:
|
12
|
-
# *
|
13
|
-
# *
|
14
|
-
# *
|
15
|
-
# *
|
12
|
+
# * +#calc_checksum+, which computes header checksum,
|
13
|
+
# * +#calc_length+, which computes header length,
|
14
|
+
# * +#parse?+,
|
15
|
+
# * +#reply!+, which inverts needed fields to forge a response.
|
16
16
|
# @author Sylvain Daubert
|
17
17
|
class Base < Types::Fields
|
18
18
|
# @api private
|
@@ -61,7 +61,7 @@ module PacketGen
|
|
61
61
|
# DUID Based on Link-layer Address Plus Time
|
62
62
|
# @author Sylvain Daubert
|
63
63
|
class DUID_LLT < DUID
|
64
|
-
|
64
|
+
remove_field :body
|
65
65
|
|
66
66
|
# Base time for time computation
|
67
67
|
BASE_TIME = Time.utc(2000, 1, 1)
|
@@ -99,7 +99,7 @@ module PacketGen
|
|
99
99
|
# DUID Based on Enterprise Number
|
100
100
|
# @author Sylvain Daubert
|
101
101
|
class DUID_EN < DUID
|
102
|
-
|
102
|
+
remove_field :body
|
103
103
|
|
104
104
|
# @!attribute en
|
105
105
|
# 32-bit entreprise number
|
@@ -119,7 +119,7 @@ module PacketGen
|
|
119
119
|
# DUID Based on Link-layer
|
120
120
|
# @author Sylvain Daubert
|
121
121
|
class DUID_LL < DUID
|
122
|
-
|
122
|
+
remove_field :body
|
123
123
|
|
124
124
|
# @!attribute htype
|
125
125
|
# 16-bit hardware protocol type
|
@@ -72,10 +72,6 @@ module PacketGen
|
|
72
72
|
# Create an Option
|
73
73
|
# @param [Hash] options
|
74
74
|
def initialize(options={})
|
75
|
-
if self.class.const_defined?(:TYPE) && options[:type].nil?
|
76
|
-
options[:type] = self.class.const_get(:TYPE)
|
77
|
-
end
|
78
|
-
|
79
75
|
options[:length] = options[:data].to_s.size if options[:data]
|
80
76
|
super
|
81
77
|
self.length = self.sz - 4 if options[:data].nil?
|
@@ -131,10 +127,8 @@ module PacketGen
|
|
131
127
|
# DHCPv6 Client ID option
|
132
128
|
# @author Sylvain Daubert
|
133
129
|
class ClientID < Option
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
delete_field :data
|
130
|
+
update_field :type, default: 1
|
131
|
+
remove_field :data
|
138
132
|
|
139
133
|
# @!attribute duid
|
140
134
|
# @return [DUID]
|
@@ -150,17 +144,14 @@ module PacketGen
|
|
150
144
|
# DHCPv6 Server ID option
|
151
145
|
# @author Sylvain Daubert
|
152
146
|
class ServerID < ClientID
|
153
|
-
|
154
|
-
TYPE = 2
|
147
|
+
update_field :type, default: 2
|
155
148
|
end
|
156
149
|
|
157
150
|
# DHCPv6 Identity Association for Non-temporary Addresses Option
|
158
151
|
# @author Sylvain Daubert
|
159
152
|
class IANA < Option
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
delete_field :data
|
153
|
+
update_field :type, default: 3
|
154
|
+
remove_field :data
|
164
155
|
|
165
156
|
# @!attribute iaid
|
166
157
|
# 32-bit IAID field
|
@@ -190,10 +181,8 @@ module PacketGen
|
|
190
181
|
# DHCPv6 Identity Association for Temporary Addresses Option
|
191
182
|
# @author Sylvain Daubert
|
192
183
|
class IATA < Option
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
delete_field :data
|
184
|
+
update_field :type, default: 4
|
185
|
+
remove_field :data
|
197
186
|
|
198
187
|
# @!attribute iaid
|
199
188
|
# 32-bit IAID field
|
@@ -215,10 +204,8 @@ module PacketGen
|
|
215
204
|
# DHCPv6 IA Address option
|
216
205
|
# @author Sylvain Daubert
|
217
206
|
class IAAddr < Option
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
delete_field :data
|
207
|
+
update_field :type, default: 5
|
208
|
+
remove_field :data
|
222
209
|
|
223
210
|
# @attribute ipv6
|
224
211
|
# IPv6 address
|
@@ -255,10 +242,8 @@ module PacketGen
|
|
255
242
|
# DHCPv6 Option Request Option
|
256
243
|
# @author Sylvain Daubert
|
257
244
|
class ORO < Option
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
delete_field :data
|
245
|
+
update_field :type, default: 6
|
246
|
+
remove_field :data
|
262
247
|
|
263
248
|
# @!attribute options
|
264
249
|
# @return [RequestedOptions]
|
@@ -284,10 +269,8 @@ module PacketGen
|
|
284
269
|
# DHCPv6 Preference option
|
285
270
|
# @author Sylvain Daubert
|
286
271
|
class Preference < Option
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
delete_field :data
|
272
|
+
update_field :type, default: 7
|
273
|
+
remove_field :data
|
291
274
|
|
292
275
|
# @!attribute value
|
293
276
|
# 8-bit value
|
@@ -304,10 +287,8 @@ module PacketGen
|
|
304
287
|
# DHCPv6 Elapsed Time option
|
305
288
|
# @author Sylvain Daubert
|
306
289
|
class ElapsedTime < Option
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
delete_field :data
|
290
|
+
update_field :type, default: 8
|
291
|
+
remove_field :data
|
311
292
|
|
312
293
|
# @!attribute value
|
313
294
|
# 16-bit value
|
@@ -324,17 +305,14 @@ module PacketGen
|
|
324
305
|
# DHCPv6 Relay Message option
|
325
306
|
# @author Sylvain Daubert
|
326
307
|
class RelayMessage < Option
|
327
|
-
|
328
|
-
TYPE = 9
|
308
|
+
update_field :type, default: 9
|
329
309
|
end
|
330
310
|
|
331
311
|
# DHCPv6 Server Unicast option
|
332
312
|
# @author Sylvain Daubert
|
333
313
|
class ServerUnicast < Option
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
delete_field :data
|
314
|
+
update_field :type, default: 12
|
315
|
+
remove_field :data
|
338
316
|
|
339
317
|
# @!attribute addr
|
340
318
|
# IPv6 server address
|
@@ -351,17 +329,14 @@ module PacketGen
|
|
351
329
|
# DHCPv6 Status Code option
|
352
330
|
# @author Sylvain Daubert
|
353
331
|
class StatusCode < ElapsedTime
|
354
|
-
|
355
|
-
TYPE = 13
|
332
|
+
update_field :type, default: 13
|
356
333
|
end
|
357
334
|
|
358
335
|
# DHCPv6 Rapid Commit option
|
359
336
|
# @author Sylvain Daubert
|
360
337
|
class RapidCommit < Option
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
delete_field :data
|
338
|
+
update_field :type, default: 14
|
339
|
+
remove_field :data
|
365
340
|
end
|
366
341
|
end
|
367
342
|
end
|
@@ -222,13 +222,13 @@ module PacketGen
|
|
222
222
|
|
223
223
|
# rubocop:disable Naming/PredicateName
|
224
224
|
|
225
|
-
# @deprecated Use {
|
225
|
+
# @deprecated Use {.fcs?} instead.
|
226
226
|
def has_fcs
|
227
227
|
Deprecation.deprecated(self, __method__, 'fcs?', klass_method: true)
|
228
228
|
fcs?
|
229
229
|
end
|
230
230
|
|
231
|
-
# @deprecated Use {
|
231
|
+
# @deprecated Use {.fcs=} instead.
|
232
232
|
def has_fcs=(fcs)
|
233
233
|
Deprecation.deprecated(self, __method__, 'fcs=', klass_method: true)
|
234
234
|
self.fcs = fcs
|
@@ -13,7 +13,8 @@ module PacketGen
|
|
13
13
|
# @author Sylvain Daubert
|
14
14
|
# @since 2.1.4
|
15
15
|
class MD5 < EAP
|
16
|
-
|
16
|
+
update_field :type, default: 4
|
17
|
+
remove_field :body
|
17
18
|
|
18
19
|
# @!attribute value_size
|
19
20
|
# @return [Integer] 8-bit value size
|
@@ -25,11 +26,6 @@ module PacketGen
|
|
25
26
|
# @!attribute optional_name
|
26
27
|
# @return [::String]
|
27
28
|
define_field :optional_name, Types::String
|
28
|
-
|
29
|
-
# @return [EAP::MD5]
|
30
|
-
def initialize(options={})
|
31
|
-
super({ type: 4 }.merge!(options))
|
32
|
-
end
|
33
29
|
end
|
34
30
|
end
|
35
31
|
end
|
@@ -18,6 +18,7 @@ module PacketGen
|
|
18
18
|
# @author Sylvain Daubert
|
19
19
|
# @since 2.1.4
|
20
20
|
class TLS < EAP
|
21
|
+
update_field :type, default: 13
|
21
22
|
# @!attribute flags
|
22
23
|
# @return [Integer] 8-bit flags
|
23
24
|
define_field_before :body, :flags, Types::Int8
|
@@ -44,11 +45,6 @@ module PacketGen
|
|
44
45
|
define_field_before :body, :tls_length, Types::Int32,
|
45
46
|
optional: ->(h) { h.l? }
|
46
47
|
|
47
|
-
# @return [EAP::TLS]
|
48
|
-
def initialize(options={})
|
49
|
-
super({ type: 13 }.merge!(options))
|
50
|
-
end
|
51
|
-
|
52
48
|
# @return [String]
|
53
49
|
def inspect
|
54
50
|
str = Inspect.dashed_line(self.class, 1)
|
@@ -18,6 +18,7 @@ module PacketGen
|
|
18
18
|
# @author Sylvain Daubert
|
19
19
|
# @since 2.1.4
|
20
20
|
class TTLS < EAP
|
21
|
+
update_field :type, default: 21
|
21
22
|
# @!attribute flags
|
22
23
|
# @return [Integer] 8-bit flags
|
23
24
|
define_field_before :body, :flags, Types::Int8
|
@@ -48,11 +49,6 @@ module PacketGen
|
|
48
49
|
define_field_before :body, :message_length, Types::Int32,
|
49
50
|
optional: ->(h) { h.l? }
|
50
51
|
|
51
|
-
# @return [EAP::TTLS]
|
52
|
-
def initialize(options={})
|
53
|
-
super({ type: 21 }.merge!(options))
|
54
|
-
end
|
55
|
-
|
56
52
|
# @return [String]
|
57
53
|
def inspect
|
58
54
|
str = Inspect.dashed_line(self.class, 1)
|
data/lib/packetgen/header/ip.rb
CHANGED
@@ -224,7 +224,7 @@ module PacketGen
|
|
224
224
|
#
|
225
225
|
# When sending packet at IP level, +checksum+ and +length+ fields are set by
|
226
226
|
# kernel, so bad IP packets cannot be sent this way. To do so, use {Eth#to_w}.
|
227
|
-
# @param [String,nil]
|
227
|
+
# @param [String,nil] _iface interface name. Not used
|
228
228
|
# @return [void]
|
229
229
|
def to_w(_iface=nil)
|
230
230
|
sock = Socket.new(Socket::AF_INET, Socket::SOCK_RAW, Socket::IPPROTO_RAW)
|
@@ -109,8 +109,8 @@ module PacketGen
|
|
109
109
|
|
110
110
|
# End-of-option-List IP option
|
111
111
|
class EOL < Option
|
112
|
-
|
113
|
-
|
112
|
+
remove_field :length
|
113
|
+
remove_field :data
|
114
114
|
end
|
115
115
|
|
116
116
|
# No OPeration IP option
|
@@ -119,7 +119,7 @@ module PacketGen
|
|
119
119
|
|
120
120
|
# Loose Source and Record Route IP option
|
121
121
|
class LSRR < Option
|
122
|
-
|
122
|
+
remove_field :data
|
123
123
|
|
124
124
|
# @!attribute pointer
|
125
125
|
# 8-bit pointer on next address
|
@@ -165,7 +165,7 @@ module PacketGen
|
|
165
165
|
|
166
166
|
# Stream Identifier IP option
|
167
167
|
class SI < Option
|
168
|
-
|
168
|
+
remove_field :data
|
169
169
|
|
170
170
|
# @!attribute id
|
171
171
|
# 16-bit stream ID
|
@@ -175,7 +175,7 @@ module PacketGen
|
|
175
175
|
|
176
176
|
# Router Alert IP option
|
177
177
|
class RA < Option
|
178
|
-
|
178
|
+
remove_field :data
|
179
179
|
|
180
180
|
# @!attribute value
|
181
181
|
# 16-bit value. Should be 0.
|
@@ -25,7 +25,7 @@ module PacketGen
|
|
25
25
|
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
26
26
|
# | ... |
|
27
27
|
# This paylod is implemented as a unique field: {#lsas}, which is an
|
28
|
-
# {
|
28
|
+
# {ArrayOfLSA} object.
|
29
29
|
#
|
30
30
|
# == Create a LSAck payload
|
31
31
|
# # standalone
|
@@ -43,7 +43,7 @@ module PacketGen
|
|
43
43
|
class LSAck < Base
|
44
44
|
# @!attribute lsas
|
45
45
|
# Array of LSA headers
|
46
|
-
# @return [
|
46
|
+
# @return [ArrayOfLSA]
|
47
47
|
define_field :lsas, ArrayOfLSA, builder: ->(_h, t) { t.new(only_headers: true) }
|
48
48
|
end
|
49
49
|
end
|
@@ -137,7 +137,7 @@ module PacketGen
|
|
137
137
|
|
138
138
|
# TFTP Read Request header
|
139
139
|
class RRQ < TFTP
|
140
|
-
|
140
|
+
remove_field :body
|
141
141
|
|
142
142
|
# @!attribute filename
|
143
143
|
# Filename to access
|
@@ -163,7 +163,7 @@ module PacketGen
|
|
163
163
|
|
164
164
|
# TFTP ACK header
|
165
165
|
class ACK < TFTP
|
166
|
-
|
166
|
+
remove_field :body
|
167
167
|
|
168
168
|
# @!attribute block_num
|
169
169
|
# 16-bit block number
|
@@ -173,7 +173,7 @@ module PacketGen
|
|
173
173
|
|
174
174
|
# TFTP ERROR header
|
175
175
|
class ERROR < TFTP
|
176
|
-
|
176
|
+
remove_field :body
|
177
177
|
|
178
178
|
# @!attribute error_code
|
179
179
|
# 16-bit error code
|
@@ -105,8 +105,11 @@ module PacketGen
|
|
105
105
|
# @param [Class] klass
|
106
106
|
# @return [void]
|
107
107
|
def self.inherited(klass)
|
108
|
+
field_defs = {}
|
109
|
+
@field_defs.each do |k, v|
|
110
|
+
field_defs[k] = v.clone
|
111
|
+
end
|
108
112
|
ordered = @ordered_fields.clone
|
109
|
-
field_defs = @field_defs.clone
|
110
113
|
bf = @bit_fields.clone
|
111
114
|
klass.class_eval do
|
112
115
|
@ordered_fields = ordered
|
@@ -208,16 +211,43 @@ module PacketGen
|
|
208
211
|
@ordered_fields[idx + 1, 0] = name
|
209
212
|
end
|
210
213
|
|
211
|
-
#
|
214
|
+
# Remove a previously defined field
|
212
215
|
# @param [Symbol] name
|
213
216
|
# @return [void]
|
214
|
-
|
217
|
+
# @since 2.8.4
|
218
|
+
def self.remove_field(name)
|
215
219
|
@ordered_fields.delete name
|
216
220
|
@field_defs.delete name
|
217
221
|
undef_method name
|
218
222
|
undef_method "#{name}="
|
219
223
|
end
|
220
224
|
|
225
|
+
# Delete a previously defined field
|
226
|
+
# @param [Symbol] name
|
227
|
+
# @return [void]
|
228
|
+
# @deprecated Use {.remove_field} instead.
|
229
|
+
# @since 2.8.4 deprecated
|
230
|
+
def self.delete_field(name)
|
231
|
+
Deprecation.deprecated(self, __method__, 'remove_field', klass_method: true)
|
232
|
+
remove_field name
|
233
|
+
end
|
234
|
+
# Update a previously defined field
|
235
|
+
# @param [Symbol] field field name to create
|
236
|
+
# @param [Hash] options See {.define_field}.
|
237
|
+
# @return [void]
|
238
|
+
# @see .define_field
|
239
|
+
# @raise [ArgumentError] unknown +field+
|
240
|
+
# @since 2.8.4
|
241
|
+
def self.update_field(field, options)
|
242
|
+
raise ArgumentError, "unkown #{field} field for #{self}" unless @field_defs.key?(field)
|
243
|
+
|
244
|
+
@field_defs[field][1] = options.delete(:default) if options.key?(:default)
|
245
|
+
@field_defs[field][2] = options.delete(:builder) if options.key?(:builder)
|
246
|
+
@field_defs[field][3] = options.delete(:optional) if options.key?(:optional)
|
247
|
+
@field_defs[field][4] = options.delete(:enum) if options.key?(:enum)
|
248
|
+
@field_defs[field][5].merge!(options)
|
249
|
+
end
|
250
|
+
|
221
251
|
# Define a bitfield on given attribute
|
222
252
|
# class MyHeader < PacketGen::Types::Fields
|
223
253
|
# define_field :flags, Types::Int16
|
@@ -296,6 +326,20 @@ module PacketGen
|
|
296
326
|
end
|
297
327
|
end
|
298
328
|
|
329
|
+
# Remove all bit fields defined on +attr+
|
330
|
+
# @param [Symbol] attr attribute defining bit fields
|
331
|
+
# @return [void]
|
332
|
+
# @since 2.8.4
|
333
|
+
def self.remove_bit_fields_on(attr)
|
334
|
+
fields = @bit_fields.delete(attr)
|
335
|
+
return if fields.nil?
|
336
|
+
|
337
|
+
fields.each do |field, size|
|
338
|
+
undef_method "#{field}="
|
339
|
+
undef_method(size == 1 ? "#{field}?" : "#{field}")
|
340
|
+
end
|
341
|
+
end
|
342
|
+
|
299
343
|
# Create a new header object
|
300
344
|
# @param [Hash] options Keys are symbols. They should have name of object
|
301
345
|
# attributes, as defined by {.define_field} and by {.define_bit_fields_on}.
|
@@ -36,7 +36,7 @@ module PacketGen
|
|
36
36
|
self
|
37
37
|
end
|
38
38
|
|
39
|
-
# @param [Integer]
|
39
|
+
# @param [Integer] len
|
40
40
|
# @return [Integer]
|
41
41
|
def length=(len)
|
42
42
|
@length.read len
|
@@ -48,7 +48,7 @@ module PacketGen
|
|
48
48
|
@length.to_i
|
49
49
|
end
|
50
50
|
|
51
|
-
# @param [#to_s]
|
51
|
+
# @param [#to_s] str
|
52
52
|
# @return [String]
|
53
53
|
def string=(str)
|
54
54
|
@length.value = str.to_s.size
|
data/lib/packetgen/utils.rb
CHANGED
@@ -74,7 +74,7 @@ module PacketGen
|
|
74
74
|
# @note This method is provided for test purpose.
|
75
75
|
# For more control, see {ARPSpoofer} class.
|
76
76
|
# @param [String] target_ip target IP address
|
77
|
-
# @param [String] spoofed_ip IP address to
|
77
|
+
# @param [String] spoofed_ip IP address to spoof
|
78
78
|
# @param [Hash] options
|
79
79
|
# @option options [String] :mac MAC address used to poison target
|
80
80
|
# ARP cache. Default to local MAC address.
|
@@ -87,7 +87,7 @@ module PacketGen
|
|
87
87
|
# @return [void]
|
88
88
|
def self.arp_spoof(target_ip, spoofed_ip, options={})
|
89
89
|
interval = options[:interval] || 1.0
|
90
|
-
as = ARPSpoofer.new(
|
90
|
+
as = ARPSpoofer.new(timeout: options[:for_seconds], interval: interval,
|
91
91
|
iface: options[:iface])
|
92
92
|
as.start(target_ip, spoofed_ip, mac: options[:mac])
|
93
93
|
as.wait
|
@@ -122,6 +122,9 @@ module PacketGen
|
|
122
122
|
def self.mitm(target1, target2, options={})
|
123
123
|
options = { iface: PacketGen.default_iface }.merge(options)
|
124
124
|
|
125
|
+
mac1 = arp(target1)
|
126
|
+
mac2 = arp(target2)
|
127
|
+
|
125
128
|
spoofer = Utils::ARPSpoofer.new(options)
|
126
129
|
spoofer.add target1, target2, options
|
127
130
|
spoofer.add target2, target1, options
|
@@ -138,7 +141,21 @@ module PacketGen
|
|
138
141
|
spoofer.start_all
|
139
142
|
capture.start do |pkt|
|
140
143
|
modified_pkt = yield pkt
|
141
|
-
modified_pkt.ip
|
144
|
+
iph = modified_pkt.ip
|
145
|
+
l2 = modified_pkt.is?('Dot11') ? modified_pkt.dot11 : modified_pkt.eth
|
146
|
+
|
147
|
+
if (iph.dst != my_ip) && (iph.src != my_ip)
|
148
|
+
if (iph.src == target1) || (iph.dst == target2)
|
149
|
+
l2.dst = mac2
|
150
|
+
elsif (iph.src == target2) ||(iph.dst == target1)
|
151
|
+
l2.dst = mac1
|
152
|
+
else
|
153
|
+
next
|
154
|
+
end
|
155
|
+
else
|
156
|
+
next
|
157
|
+
end
|
158
|
+
modified_pkt.to_w(options[:iface])
|
142
159
|
end
|
143
160
|
end
|
144
161
|
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: 2.8.
|
4
|
+
version: 2.8.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sylvain Daubert
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-10-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: interfacez
|