unified2 0.5.4 → 0.6.0

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.
Files changed (46) hide show
  1. data/ChangeLog.md +10 -0
  2. data/README.md +41 -35
  3. data/Rakefile +3 -2
  4. data/bin/ru2 +76 -0
  5. data/example/example.rb +10 -18
  6. data/example/example2.rb +44 -0
  7. data/example/seeds/classification.config +1 -1
  8. data/example/seeds/gen-msg.map +86 -9
  9. data/example/seeds/sid-msg.map +2849 -316
  10. data/example/seeds/unified2-current.log +0 -0
  11. data/example/seeds/{unified2.log → unified2-legacy.log} +0 -0
  12. data/gemspec.yml +2 -1
  13. data/lib/unified2/classification.rb +12 -0
  14. data/lib/unified2/config_file.rb +4 -1
  15. data/lib/unified2/constructor/construct.rb +52 -6
  16. data/lib/unified2/constructor/event_ip4.rb +18 -3
  17. data/lib/unified2/constructor/event_ip6.rb +22 -4
  18. data/lib/unified2/constructor/extra_construct.rb +46 -0
  19. data/lib/unified2/constructor/extra_data.rb +37 -0
  20. data/lib/unified2/constructor/extra_data_header.rb +28 -0
  21. data/lib/unified2/constructor/legacy_event_ip4.rb +54 -0
  22. data/lib/unified2/constructor/legacy_event_ip6.rb +52 -0
  23. data/lib/unified2/constructor/packet.rb +9 -1
  24. data/lib/unified2/constructor/primitive/ipv4.rb +9 -0
  25. data/lib/unified2/constructor/record_header.rb +9 -0
  26. data/lib/unified2/constructor.rb +2 -1
  27. data/lib/unified2/core_ext/string.rb +2 -1
  28. data/lib/unified2/event.rb +290 -165
  29. data/lib/unified2/exceptions/binary_read_error.rb +11 -0
  30. data/lib/unified2/exceptions/file_not_found.rb +4 -1
  31. data/lib/unified2/exceptions/file_not_readable.rb +4 -1
  32. data/lib/unified2/exceptions/unknown_load_type.rb +4 -1
  33. data/lib/unified2/exceptions.rb +2 -1
  34. data/lib/unified2/extra.rb +128 -0
  35. data/lib/unified2/packet.rb +211 -0
  36. data/lib/unified2/protocol.rb +54 -63
  37. data/lib/unified2/sensor.rb +14 -2
  38. data/lib/unified2/signature.rb +12 -0
  39. data/lib/unified2/version.rb +4 -1
  40. data/lib/unified2.rb +65 -81
  41. data/spec/event_spec.rb +40 -27
  42. data/spec/legacy_event_spec.rb +122 -0
  43. data/spec/spec_helper.rb +10 -21
  44. data/spec/unified2_spec.rb +3 -3
  45. metadata +124 -140
  46. data/lib/unified2/payload.rb +0 -114
@@ -1,20 +1,48 @@
1
- require 'unified2/classification'
2
- require 'unified2/payload'
3
- require 'unified2/protocol'
4
- require 'unified2/sensor'
5
- require 'unified2/signature'
6
-
7
1
  require 'packetfu'
8
2
  require 'ipaddr'
9
3
  require 'json'
10
4
 
5
+ require 'unified2/extra'
6
+ require 'unified2/classification'
7
+ require 'unified2/packet'
8
+ require 'unified2/sensor'
9
+ require 'unified2/signature'
10
+
11
+ #
12
+ # Unified2
13
+ #
11
14
  module Unified2
15
+
12
16
  #
13
17
  # Event
14
18
  #
15
19
  class Event
20
+
21
+ #
22
+ # Normal Event headers types
23
+ #
24
+ EVENT_TYPES = [7, 72, 104, 105]
25
+
26
+ #
27
+ # Extra Data Event Header Types
28
+ #
29
+ EXTRA = [ 110 ]
30
+
31
+ #
32
+ # Legacy Event Header Types
33
+ #
34
+ LEGACY_EVENT_TYPES = [7, 72]
35
+
36
+ #
37
+ # Packet Event Header Types
38
+ #
39
+ PACKET_TYPES = [2]
40
+
41
+ #
42
+ # Setup method defaults
43
+ #
44
+ attr_accessor :id, :event, :packets, :extras
16
45
 
17
- attr_accessor :id, :event_data, :packet_data
18
46
  #
19
47
  # Initialize event
20
48
  #
@@ -22,6 +50,8 @@ module Unified2
22
50
  #
23
51
  def initialize(id)
24
52
  @id = id.to_i
53
+ @packets = []
54
+ @extras = []
25
55
  end
26
56
 
27
57
  #
@@ -61,9 +91,7 @@ module Unified2
61
91
  # @return [Time, nil] Event time object
62
92
  #
63
93
  def event_time
64
- if @packet_data.has_key?(:event_second)
65
- @timestamp = Time.at(@packet_data[:event_second].to_i)
66
- end
94
+ Time.at(@event_data[:timestamp].to_i)
67
95
  end
68
96
  alias :timestamp :event_time
69
97
 
@@ -75,9 +103,7 @@ module Unified2
75
103
  # @return [String, nil] Event microseconds
76
104
  #
77
105
  def microseconds
78
- if @event_data.has_key?(:event_microsecond)
79
- @microseconds = @event_data[:event_microsecond]
80
- end
106
+ @event_data[:event_microsecond]
81
107
  end
82
108
 
83
109
  #
@@ -95,9 +121,34 @@ module Unified2
95
121
  # @return [Integer, nil] Packet action
96
122
  #
97
123
  def packet_action
98
- if @event_data.has_key?(:event_second)
99
- @packet_data_action = @event_data[:packet_action]
100
- end
124
+ @event_data[:packet_action]
125
+ end
126
+
127
+ #
128
+ # ICMP?
129
+ #
130
+ # @return [true, false] Check is protocol is icmp
131
+ #
132
+ def icmp?
133
+ protocol == :ICMP
134
+ end
135
+
136
+ #
137
+ # TCP?
138
+ #
139
+ # @return [true, false] Check is protocol is tcp
140
+ #
141
+ def tcp?
142
+ protocol == :TCP
143
+ end
144
+
145
+ #
146
+ # UDP?
147
+ #
148
+ # @return [true, false] Check is protocol is udp
149
+ #
150
+ def udp?
151
+ protocol == :UDP
101
152
  end
102
153
 
103
154
  #
@@ -106,17 +157,16 @@ module Unified2
106
157
  # @return [Protocol] Event protocol object
107
158
  #
108
159
  def protocol
109
- @protocol = Protocol.new(determine_protocol(@event_data[:protocol]), packet)
160
+ @protocol ||= determine_protocol
110
161
  end
111
162
 
112
-
113
163
  #
114
164
  # Classification
115
165
  #
116
166
  # @return [Classification] Event classification object
117
167
  #
118
168
  def classification
119
- @classification = Classification.new(@event_data[:classification]) if @event_data[:classification]
169
+ Classification.new(@event_data[:classification])
120
170
  end
121
171
 
122
172
  #
@@ -125,9 +175,7 @@ module Unified2
125
175
  # @return [Signature, nil] Event signature object
126
176
  #
127
177
  def signature
128
- if @event_data.is_a?(Hash)
129
- @signature = Signature.new(@event_data[:signature])
130
- end
178
+ @signature ||= Signature.new(@event_data[:signature])
131
179
  end
132
180
 
133
181
  #
@@ -136,9 +184,7 @@ module Unified2
136
184
  # @return [IPAddr] Event source ip address
137
185
  #
138
186
  def ip_source
139
- if @event_data.is_a?(Hash)
140
- @event_data[:ip_source] if @event_data.has_key?(:ip_source)
141
- end
187
+ @event_data[:source_ip]
142
188
  end
143
189
  alias :source_ip :ip_source
144
190
 
@@ -152,8 +198,7 @@ module Unified2
152
198
  # event protocol is icmp.
153
199
  #
154
200
  def source_port
155
- return 0 if protocol.icmp?
156
- @source_port = @event_data[:sport_itype] if @event_data.has_key?(:sport_itype)
201
+ @event_data[:source_port]
157
202
  end
158
203
 
159
204
  #
@@ -162,9 +207,7 @@ module Unified2
162
207
  # @return [IPAddr] Event destination ip address
163
208
  #
164
209
  def ip_destination
165
- if @event_data.is_a?(Hash)
166
- @event_data[:ip_destination] if @event_data.has_key?(:ip_destination)
167
- end
210
+ @event_data[:destination_ip]
168
211
  end
169
212
  alias :destination_ip :ip_destination
170
213
 
@@ -178,8 +221,7 @@ module Unified2
178
221
  # event protocol is icmp.
179
222
  #
180
223
  def destination_port
181
- return 0 if protocol.icmp?
182
- @source_port = @event_data[:dport_icode] if @event_data.has_key?(:dport_icode)
224
+ @event_data[:destination_port]
183
225
  end
184
226
 
185
227
  #
@@ -192,45 +234,74 @@ module Unified2
192
234
  end
193
235
 
194
236
  #
195
- # Packet
196
- #
197
- # @return [Packet] Event packet object
198
- #
199
- # @note
200
- # Please view the packetfu documentation for more
201
- # information. (http://code.google.com/p/packetfu/)
202
- #
203
- def packet
204
- @packet = PacketFu::Packet.parse(@packet_data[:packet])
237
+ # Packets
238
+ #
239
+ # @yield [Packet] Description
240
+ #
241
+ # @return [Array] Packet object array
242
+ #
243
+ def packets
244
+ return @packets unless block_given?
245
+ @packets.each { |packet| yield packet }
205
246
  end
206
247
 
207
248
  #
208
- # Payload
249
+ # Has Packet Data
209
250
  #
210
- # @return [Payload] Event payload object
251
+ # @return [True,False] Does the event have packet data?
211
252
  #
212
- def payload
213
- Payload.new(packet.payload, @packet_data)
253
+ def packets?
254
+ @packets.empty?
214
255
  end
215
-
256
+
257
+ #
258
+ # Extras
259
+ #
260
+ # @yield [Extra] yield event extra objects
261
+ #
262
+ # @return [Array] Extra object array
263
+ #
264
+ def extras
265
+ return @extras unless block_given?
266
+ @extras.each { |extra| yield extra }
267
+ end
268
+
269
+ #
270
+ # Has Extra Data
271
+ #
272
+ # @return [True,False] Does the event have extra data?
273
+ #
274
+ def extras?
275
+ @extras.empty?
276
+ end
277
+
216
278
  #
217
279
  # Load
218
280
  #
219
281
  # Initializes the raw data returned by
220
- # bindata into a more comfurtable format.
282
+ # bindata into a more comfortable format.
221
283
  #
222
284
  # @param [Hash] Name Description
223
285
  #
224
286
  # @return [nil]
225
287
  #
226
288
  def load(event)
227
- if event.data.respond_to?(:signature_id)
228
- @event_data ||= build_event_data(event)
289
+
290
+ if EXTRA.include?(event.header.u2type)
291
+ extra = Extra.new(event)
292
+ @extras.push(extra)
229
293
  end
230
294
 
231
- if event.data.respond_to?(:packet_data)
232
- @packet_data ||= build_packet_data(event)
295
+ if EVENT_TYPES.include?(event.header.u2type)
296
+ @event = event
297
+ @event_data = build_event_data
233
298
  end
299
+
300
+ if PACKET_TYPES.include?(event.header.u2type)
301
+ packet = Packet.new(build_packet_data(event))
302
+ @packets.push(packet)
303
+ end
304
+
234
305
  end
235
306
 
236
307
  #
@@ -241,11 +312,23 @@ module Unified2
241
312
  def to_h
242
313
  @to_hash = {}
243
314
 
244
- [@event_data, @packet_data].each do |hash|
245
- @to_hash.merge!(hash) if hash.is_a?(Hash)
246
- end
315
+ @event_data[:extras] = @extras
316
+ @event_data[:packets] = @packets
317
+
318
+ #unless payload.blank?
319
+ #hexdump = ''
320
+ #payload.dump(:width => 30, :output => hexdump)
321
+ #@packet_data[:packet] = hexdump
322
+ #end
323
+
324
+ #.encode('utf-8', 'iso-8859-1')
247
325
 
248
- @to_hash
326
+ #[@event_data, @packet_data].each do |hash|
327
+ #@to_hash.merge!(hash) if hash.is_a?(Hash)
328
+ #end
329
+
330
+ #@to_hash
331
+ @event_data
249
332
  end
250
333
 
251
334
  #
@@ -266,161 +349,201 @@ module Unified2
266
349
  to_h.to_json
267
350
  end
268
351
 
269
- #
270
- # IP Header
271
- #
272
- # @return [Hash] IP header
273
- #
274
- def ip_header
275
- if ((packet.is_ip?) && packet.has_data?)
276
- @ip_header = {
277
- :ip_ver => packet.ip_header.ip_v,
278
- :ip_hlen => packet.ip_header.ip_hl,
279
- :ip_tos => packet.ip_header.ip_tos,
280
- :ip_len => packet.ip_header.ip_len,
281
- :ip_id => packet.ip_header.ip_id,
282
- :ip_frag => packet.ip_header.ip_frag,
283
- :ip_ttl => packet.ip_header.ip_ttl,
284
- :ip_proto => packet.ip_header.ip_proto,
285
- :ip_csum => packet.ip_header.ip_sum
286
- }
287
- else
288
- @ip_header = {}
289
- end
290
- end
291
-
292
352
  #
293
353
  # Convert To String
294
354
  #
295
355
  # @return [String] Event string object
296
356
  #
297
357
  def to_s
298
- data = %{
299
- Sensor: #{sensor.id}
300
- Event ID: #{id}
301
- Timestamp: #{timestamp.strftime('%D %H:%M:%S')}
302
- Severity: #{severity}
303
- Protocol: #{protocol}
304
- Source IP: #{source_ip}:#{source_port}
305
- Destination IP: #{destination_ip}:#{destination_port}
306
- Signature: #{signature.name}
307
- Classification: #{classification.name}
308
- Event Checksum: #{checksum}
309
- }
310
- unless payload.blank?
311
- data += "Payload Checksum: #{payload.checksum}\n"
312
- data += "Payload:\n"
313
- payload.dump(:width => 30, :output => data)
358
+ data = "EVENT\n"
359
+ data += "\tevent id: #{id}\n"
360
+ data += "\tsensor id: #{sensor.id}\n"
361
+ data += "\ttimestamp: #{timestamp.strftime('%D %H:%M:%S')}\n"
362
+ data += "\tseverity: #{severity}\n"
363
+ data += "\tprotocol: #{protocol}\n"
364
+ data += "\tsource ip: #{source_ip} (#{source_port})\n"
365
+ data += "\tdestination ip: #{destination_ip} (#{destination_port})\n"
366
+ data += "\tsignature: #{signature.name}\n"
367
+ data += "\tclassification: #{classification.name}\n"
368
+ data += "\tchecksum: #{checksum}\n"
369
+
370
+ packet_count = 1
371
+ length = packets.count
372
+
373
+ packets.each do |packet|
374
+ data += "\n\tPACKET (#{packet_count} of #{length})\n\n"
375
+
376
+ data += "\tsensor id: #{sensor.id}"
377
+ data += "\tevent id: #{id}"
378
+ data += "\tevent second: #{packet.event_timestamp.to_i}\n"
379
+ data += "\tpacket second: #{packet.timestamp.to_i}"
380
+ data += "\tpacket microsecond: #{packet.microsecond.to_i}\n"
381
+ data += "\tlinktype: #{packet.link_type}"
382
+ data += "\tpacket length: #{packet.length}\n"
383
+ data += "\tchecksum: #{packet.checksum}\n\n"
384
+
385
+ hexdump = packet.hexdump(:width => 16)
386
+ hexdump.each_line { |line| data += "\t" + line }
387
+
388
+ packet_count += 1
389
+ end
390
+
391
+ extra_count = 1
392
+ length = extras.count
393
+
394
+ extras.each do |extra|
395
+ data += "\n\tEXTRA (#{extra_count} of #{length})\n\n"
396
+
397
+ data += "\tname: #{extra.name}"
398
+ data += "\tevent type: #{extra.header[:event_type]}"
399
+ data += "\tevent length: #{extra.header[:event_length]}\n"
400
+ data += "\tsensor id: #{sensor.id}"
401
+ data += "\tevent id: #{id}"
402
+ data += "\tevent second: #{extra.timestamp}\n"
403
+ data += "\ttype: #{extra.type_id}"
404
+ data += "\tdata type: #{extra.data_type}"
405
+ data += "\tlength: #{extra.length}\n"
406
+ data += "\tvalue: " + extra.value + "\n"
407
+
408
+ extra_count += 1
314
409
  end
315
410
 
316
- data.gsub(/^\s+/, "")
411
+ data += "\n"
317
412
  end
318
413
 
319
414
  private
320
415
 
321
- def build_event_data(event)
322
- @event_hash = {}
323
-
324
- @event_hash = {
325
- :ip_destination => event.data.ip_destination,
326
- :priority_id => event.data.priority_id,
327
- :signature_revision => event.data.signature_revision,
328
- :event_id => event.data.event_id,
329
- :protocol => event.data.protocol,
330
- :sport_itype => event.data.sport_itype,
331
- :event_second => event.data.event_second,
332
- :packet_action => event.data.packet_action,
333
- :dport_icode => event.data.dport_icode,
334
- :sensor_id => event.data.sensor_id,
335
- :generator_id => event.data.generator_id,
336
- :ip_source => event.data.ip_source,
337
- :event_microsecond => event.data.event_microsecond
416
+ def build_event_data
417
+ event_hash = {}
418
+
419
+ event_hash = {
420
+ :destination_ip => @event.data.ip_destination,
421
+ :priority_id => @event.data.priority_id,
422
+ :signature_revision => @event.data.signature_revision,
423
+ :event_id => @event.data.event_id,
424
+ :protocol => @event.data.protocol,
425
+ :source_port => @event.data.sport_itype,
426
+ :timestamp => @event.data.event_second,
427
+ :destination_port => @event.data.dport_icode,
428
+ :sensor_id => @event.data.sensor_id,
429
+ :generator_id => @event.data.generator_id,
430
+ :source_ip => @event.data.ip_source,
431
+ :event_microsecond => @event.data.event_microsecond
338
432
  }
339
433
 
340
- build_classifications(event)
434
+ if LEGACY_EVENT_TYPES.include?(@event.header.u2type)
435
+ event_hash[:packet_action] = @event.data.packet_action
436
+ else
437
+ event_hash.merge!({
438
+ :impact_flag => @event.data.impact_flag,
439
+ :impact => @event.data.impact,
440
+ :blocked => @event.data.blocked,
441
+ :mpls_label => @event.data.mpls_label,
442
+ :vlan_id => @event.data.vlanId,
443
+ :policy_id => @event.data.pad2
444
+ })
445
+ end
446
+
447
+ event_hash[:classification] = build_classifications
341
448
 
342
- if event.data.generator_id.to_i == 1
343
- build_signature(event)
449
+ if @event.data.generator_id.to_i == 1
450
+ event_hash[:signature] = build_signature
344
451
  else
345
- build_generator(event)
452
+ event_hash[:signature] = build_generator
346
453
  end
347
454
 
348
- @event_hash
455
+ event_hash
349
456
  end
350
457
 
351
- def build_packet_data(event)
352
- @packet_hash = {}
353
- @packet_hash = {
354
- :linktype => event.data.linktype,
355
- :packet_microsecond => event.data.packet_microsecond,
356
- :packet_second => event.data.packet_second,
357
- :packet => event.data.packet_data,
358
- :event_second => event.data.event_second,
359
- :packet_length => event.data.packet_length
458
+ def build_packet_data(packet)
459
+ packet_hash = {}
460
+ packet_hash = {
461
+ :linktype => packet.data.linktype,
462
+ :packet_microsecond => packet.data.packet_microsecond,
463
+ :packet_timestamp => packet.data.packet_second,
464
+ :packet => packet.data.packet_data,
465
+ :timestamp => packet.data.event_second,
466
+ :packet_length => packet.data.packet_length
360
467
  }
361
468
 
362
- @packet_hash
469
+ packet_hash
363
470
  end
364
471
 
365
- def build_generator(event)
366
- if Unified2.generators.data
367
- if Unified2.generators.data.has_key?("#{event.data.generator_id}.#{event.data.signature_id}")
368
- sig = Unified2.generators.data["#{event.data.generator_id}.#{event.data.signature_id}"]
472
+ def build_generator
473
+ signature = {}
369
474
 
370
- @event_hash[:signature] = {
371
- :signature_id => event.data.signature_id,
372
- :generator_id => event.data.generator_id,
373
- :revision => event.data.signature_revision,
475
+ if Unified2.generators
476
+ key = "#{@event.data.generator_id}.#{@event.data.signature_id}"
477
+
478
+ if Unified2.generators.data.has_key?(key)
479
+ sig = Unified2.generators.data[key]
480
+
481
+ signature = {
482
+ :signature_id => @event.data.signature_id,
483
+ :generator_id => @event.data.generator_id,
484
+ :revision => @event.data.signature_revision,
374
485
  :name => sig[:name],
375
486
  :blank => false
376
487
  }
377
488
  end
378
489
  end
379
490
 
380
- unless @event_hash.has_key?(:signature)
381
- @event_hash[:signature] = {
382
- :signature_id => event.data.signature_id,
383
- :generator_id => event.data.generator_id,
491
+ if signature.empty?
492
+ signature = {
493
+ :signature_id => @event.data.signature_id,
494
+ :generator_id => @event.data.generator_id,
384
495
  :revision => 0,
385
- :name => "Unknown Signature #{event.data.signature_id}",
496
+ :name => "Unknown Signature #{@event.data.signature_id}",
386
497
  :blank => true
387
498
  }
388
499
  end
500
+
501
+ signature
389
502
  end
390
503
 
391
- def build_signature(event)
392
- if Unified2.signatures.data
393
- if Unified2.signatures.data.has_key?(event.data.signature_id.to_s)
394
- sig = Unified2.signatures.data[event.data.signature_id.to_s]
504
+ def build_signature
505
+ signature = {}
395
506
 
396
- @event_hash[:signature] = {
397
- :signature_id => event.data.signature_id,
398
- :generator_id => event.data.generator_id,
399
- :revision => event.data.signature_revision,
507
+ if Unified2.signatures
508
+ key = event.data.signature_id.to_s
509
+
510
+ if Unified2.signatures.data.has_key?(key)
511
+ sig = Unified2.signatures.data[key]
512
+
513
+ signature = {
514
+ :signature_id => @event.data.signature_id,
515
+ :generator_id => @event.data.generator_id,
516
+ :revision => @event.data.signature_revision,
400
517
  :name => sig[:name],
401
518
  :blank => false
402
519
  }
403
520
  end
404
521
  end
405
522
 
406
- unless @event_hash.has_key?(:signature)
407
- @event_hash[:signature] = {
408
- :signature_id => event.data.signature_id,
409
- :generator_id => event.data.generator_id,
523
+ if signature.empty?
524
+ signature = {
525
+ :signature_id => @event.data.signature_id,
526
+ :generator_id => @event.data.generator_id,
410
527
  :revision => 0,
411
- :name => "Unknown Signature #{event.data.signature_id}",
528
+ :name => "Unknown Signature #{@event.data.signature_id}",
412
529
  :blank => true
413
530
  }
414
531
  end
532
+
533
+ signature
415
534
  end
416
535
 
417
- def build_classifications(event)
418
- if Unified2.classifications.data
419
- if Unified2.classifications.data.has_key?("#{event.data.classification_id}")
420
- classification = Unified2.classifications.data["#{event.data.classification_id}"]
536
+ def build_classifications
537
+ classification = {}
421
538
 
422
- @event_hash[:classification] = {
423
- :classification_id => event.data.classification_id,
539
+ if Unified2.classifications
540
+ key = "#{event.data.classification_id}"
541
+
542
+ if Unified2.classifications.data.has_key?(key)
543
+ classification = Unified2.classifications.data[key]
544
+
545
+ classification = {
546
+ :classification_id => @event.data.classification_id,
424
547
  :name => classification[:name],
425
548
  :short => classification[:short],
426
549
  :severity => classification[:severity_id]
@@ -428,18 +551,20 @@ module Unified2
428
551
  end
429
552
  end
430
553
 
431
- unless @event_hash.has_key?(:classification)
432
- @event_hash[:classification] = {
433
- :classification_id => event.data.classification_id,
554
+ if classification.empty?
555
+ classification = {
556
+ :classification_id => @event.data.classification_id,
434
557
  :name => 'Unknown',
435
558
  :short => 'n/a',
436
559
  :severity => 0
437
560
  }
438
561
  end
562
+
563
+ classification
439
564
  end
440
565
 
441
- def determine_protocol(protocol)
442
- case protocol.to_i
566
+ def determine_protocol
567
+ case @event.data.protocol.to_i
443
568
  when 1
444
569
  :ICMP # ICMP (Internet Control Message Protocol) packet type.
445
570
  when 2
@@ -0,0 +1,11 @@
1
+ #
2
+ # Unified2
3
+ #
4
+ module Unified2
5
+ #
6
+ # Binary Read Error
7
+ #
8
+ class BinaryReadError < StandardError; end # class BinaryReadError
9
+
10
+ end # module Unified2
11
+
@@ -1,7 +1,10 @@
1
+ #
2
+ # Unified2
3
+ #
1
4
  module Unified2
2
5
  #
3
6
  # File Not Found
4
7
  #
5
8
  class FileNotFound < StandardError; end # class FileNotFound
6
9
 
7
- end # module Unified2
10
+ end # module Unified2
@@ -1,7 +1,10 @@
1
+ #
2
+ # Unified2
3
+ #
1
4
  module Unified2
2
5
  #
3
6
  # File Not Readable
4
7
  #
5
8
  class FileNotReadable < StandardError; end # class FileNotReadable
6
9
 
7
- end # module Unified2
10
+ end # module Unified2