unified2 0.3.0 → 0.3.1

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.
data/ChangeLog.rdoc CHANGED
@@ -1,3 +1,7 @@
1
+ === 0.3.1 / 2011-03-15
2
+
3
+ * Removed gibbler in favor of custom Event#checksum method due to datamapper issues.
4
+
1
5
  === 0.3.0 / 2011-03-14
2
6
 
3
7
  * Added checksum support for event objects
@@ -0,0 +1,775 @@
1
+ !RBIX
2
+ 0
3
+ x
4
+ M
5
+ 1
6
+ n
7
+ n
8
+ x
9
+ 10
10
+ __script__
11
+ i
12
+ 402
13
+ 5
14
+ 7
15
+ 0
16
+ 64
17
+ 47
18
+ 49
19
+ 1
20
+ 1
21
+ 15
22
+ 5
23
+ 7
24
+ 2
25
+ 64
26
+ 47
27
+ 49
28
+ 1
29
+ 1
30
+ 15
31
+ 26
32
+ 93
33
+ 0
34
+ 15
35
+ 29
36
+ 75
37
+ 0
38
+ 5
39
+ 7
40
+ 3
41
+ 64
42
+ 7
43
+ 4
44
+ 64
45
+ 47
46
+ 49
47
+ 5
48
+ 2
49
+ 15
50
+ 5
51
+ 7
52
+ 6
53
+ 64
54
+ 47
55
+ 49
56
+ 1
57
+ 1
58
+ 15
59
+ 45
60
+ 7
61
+ 8
62
+ 43
63
+ 9
64
+ 13
65
+ 71
66
+ 10
67
+ 47
68
+ 9
69
+ 69
70
+ 47
71
+ 49
72
+ 11
73
+ 0
74
+ 13
75
+ 47
76
+ 49
77
+ 12
78
+ 0
79
+ 15
80
+ 8
81
+ 72
82
+ 49
83
+ 10
84
+ 0
85
+ 30
86
+ 8
87
+ 126
88
+ 26
89
+ 93
90
+ 1
91
+ 15
92
+ 24
93
+ 13
94
+ 45
95
+ 13
96
+ 14
97
+ 12
98
+ 49
99
+ 15
100
+ 1
101
+ 10
102
+ 92
103
+ 8
104
+ 121
105
+ 15
106
+ 24
107
+ 19
108
+ 0
109
+ 15
110
+ 45
111
+ 16
112
+ 17
113
+ 20
114
+ 0
115
+ 49
116
+ 18
117
+ 0
118
+ 49
119
+ 19
120
+ 1
121
+ 15
122
+ 45
123
+ 16
124
+ 20
125
+ 7
126
+ 21
127
+ 64
128
+ 49
129
+ 19
130
+ 1
131
+ 25
132
+ 8
133
+ 126
134
+ 15
135
+ 92
136
+ 1
137
+ 27
138
+ 34
139
+ 92
140
+ 0
141
+ 27
142
+ 15
143
+ 26
144
+ 93
145
+ 2
146
+ 15
147
+ 29
148
+ 189
149
+ 0
150
+ 5
151
+ 7
152
+ 22
153
+ 64
154
+ 7
155
+ 23
156
+ 64
157
+ 47
158
+ 49
159
+ 5
160
+ 2
161
+ 15
162
+ 5
163
+ 7
164
+ 24
165
+ 64
166
+ 47
167
+ 49
168
+ 1
169
+ 1
170
+ 15
171
+ 45
172
+ 25
173
+ 26
174
+ 43
175
+ 27
176
+ 43
177
+ 28
178
+ 13
179
+ 71
180
+ 10
181
+ 47
182
+ 9
183
+ 183
184
+ 47
185
+ 49
186
+ 11
187
+ 0
188
+ 13
189
+ 47
190
+ 49
191
+ 12
192
+ 0
193
+ 15
194
+ 8
195
+ 186
196
+ 49
197
+ 10
198
+ 0
199
+ 30
200
+ 8
201
+ 228
202
+ 26
203
+ 93
204
+ 3
205
+ 15
206
+ 24
207
+ 13
208
+ 45
209
+ 13
210
+ 29
211
+ 12
212
+ 49
213
+ 15
214
+ 1
215
+ 10
216
+ 206
217
+ 8
218
+ 223
219
+ 15
220
+ 24
221
+ 19
222
+ 0
223
+ 15
224
+ 5
225
+ 7
226
+ 30
227
+ 56
228
+ 31
229
+ 47
230
+ 50
231
+ 32
232
+ 1
233
+ 25
234
+ 8
235
+ 228
236
+ 15
237
+ 92
238
+ 3
239
+ 27
240
+ 34
241
+ 92
242
+ 2
243
+ 27
244
+ 15
245
+ 5
246
+ 44
247
+ 43
248
+ 33
249
+ 79
250
+ 49
251
+ 34
252
+ 1
253
+ 13
254
+ 7
255
+ 35
256
+ 7
257
+ 30
258
+ 49
259
+ 36
260
+ 2
261
+ 15
262
+ 47
263
+ 49
264
+ 32
265
+ 1
266
+ 15
267
+ 5
268
+ 44
269
+ 43
270
+ 33
271
+ 79
272
+ 49
273
+ 34
274
+ 1
275
+ 13
276
+ 7
277
+ 37
278
+ 7
279
+ 30
280
+ 49
281
+ 36
282
+ 2
283
+ 15
284
+ 47
285
+ 49
286
+ 32
287
+ 1
288
+ 15
289
+ 26
290
+ 93
291
+ 4
292
+ 15
293
+ 29
294
+ 335
295
+ 0
296
+ 5
297
+ 7
298
+ 38
299
+ 64
300
+ 7
301
+ 39
302
+ 64
303
+ 47
304
+ 49
305
+ 5
306
+ 2
307
+ 15
308
+ 5
309
+ 7
310
+ 38
311
+ 64
312
+ 47
313
+ 49
314
+ 1
315
+ 1
316
+ 15
317
+ 45
318
+ 40
319
+ 41
320
+ 43
321
+ 42
322
+ 43
323
+ 43
324
+ 13
325
+ 71
326
+ 10
327
+ 47
328
+ 9
329
+ 329
330
+ 47
331
+ 49
332
+ 11
333
+ 0
334
+ 13
335
+ 47
336
+ 49
337
+ 12
338
+ 0
339
+ 15
340
+ 8
341
+ 332
342
+ 49
343
+ 10
344
+ 0
345
+ 30
346
+ 8
347
+ 374
348
+ 26
349
+ 93
350
+ 5
351
+ 15
352
+ 24
353
+ 13
354
+ 45
355
+ 13
356
+ 44
357
+ 12
358
+ 49
359
+ 15
360
+ 1
361
+ 10
362
+ 352
363
+ 8
364
+ 369
365
+ 15
366
+ 24
367
+ 19
368
+ 0
369
+ 15
370
+ 5
371
+ 7
372
+ 45
373
+ 56
374
+ 46
375
+ 47
376
+ 50
377
+ 32
378
+ 1
379
+ 25
380
+ 8
381
+ 374
382
+ 15
383
+ 92
384
+ 5
385
+ 27
386
+ 34
387
+ 92
388
+ 4
389
+ 27
390
+ 15
391
+ 5
392
+ 44
393
+ 43
394
+ 33
395
+ 79
396
+ 49
397
+ 34
398
+ 1
399
+ 13
400
+ 7
401
+ 47
402
+ 7
403
+ 45
404
+ 49
405
+ 36
406
+ 2
407
+ 15
408
+ 47
409
+ 49
410
+ 32
411
+ 1
412
+ 15
413
+ 2
414
+ 11
415
+ I
416
+ c
417
+ I
418
+ 1
419
+ I
420
+ 0
421
+ I
422
+ 0
423
+ n
424
+ p
425
+ 48
426
+ s
427
+ 8
428
+ rubygems
429
+ x
430
+ 7
431
+ require
432
+ s
433
+ 4
434
+ rake
435
+ s
436
+ 9
437
+ ore-tasks
438
+ s
439
+ 8
440
+ ~> 0.5.0
441
+ x
442
+ 3
443
+ gem
444
+ s
445
+ 9
446
+ ore/tasks
447
+ x
448
+ 3
449
+ Ore
450
+ n
451
+ x
452
+ 5
453
+ Tasks
454
+ x
455
+ 3
456
+ new
457
+ x
458
+ 8
459
+ allocate
460
+ x
461
+ 10
462
+ initialize
463
+ x
464
+ 9
465
+ LoadError
466
+ n
467
+ x
468
+ 3
469
+ ===
470
+ x
471
+ 6
472
+ STDERR
473
+ n
474
+ x
475
+ 7
476
+ message
477
+ x
478
+ 4
479
+ puts
480
+ n
481
+ s
482
+ 51
483
+ Run `gem install ore-tasks` to install 'ore/tasks'.
484
+ s
485
+ 5
486
+ rspec
487
+ s
488
+ 6
489
+ ~> 2.4
490
+ s
491
+ 20
492
+ rspec/core/rake_task
493
+ x
494
+ 5
495
+ RSpec
496
+ n
497
+ x
498
+ 4
499
+ Core
500
+ x
501
+ 8
502
+ RakeTask
503
+ n
504
+ x
505
+ 4
506
+ spec
507
+ M
508
+ 1
509
+ p
510
+ 2
511
+ x
512
+ 9
513
+ for_block
514
+ t
515
+ n
516
+ x
517
+ 9
518
+ __block__
519
+ i
520
+ 9
521
+ 5
522
+ 7
523
+ 0
524
+ 64
525
+ 47
526
+ 49
527
+ 1
528
+ 1
529
+ 11
530
+ I
531
+ 3
532
+ I
533
+ 0
534
+ I
535
+ 0
536
+ I
537
+ 0
538
+ I
539
+ -2
540
+ p
541
+ 2
542
+ s
543
+ 48
544
+ Please run `gem install rspec` to install RSpec.
545
+ x
546
+ 5
547
+ abort
548
+ p
549
+ 3
550
+ I
551
+ 0
552
+ I
553
+ 15
554
+ I
555
+ 9
556
+ x
557
+ 49
558
+ /Users/dustinwebber/source/ruby/unified2/Rakefile
559
+ p
560
+ 0
561
+ x
562
+ 4
563
+ task
564
+ x
565
+ 4
566
+ Hash
567
+ x
568
+ 16
569
+ new_from_literal
570
+ x
571
+ 4
572
+ test
573
+ x
574
+ 3
575
+ []=
576
+ x
577
+ 7
578
+ default
579
+ s
580
+ 4
581
+ yard
582
+ s
583
+ 8
584
+ ~> 0.6.0
585
+ x
586
+ 4
587
+ YARD
588
+ n
589
+ x
590
+ 4
591
+ Rake
592
+ x
593
+ 10
594
+ YardocTask
595
+ n
596
+ x
597
+ 4
598
+ yard
599
+ M
600
+ 1
601
+ p
602
+ 2
603
+ x
604
+ 9
605
+ for_block
606
+ t
607
+ n
608
+ x
609
+ 9
610
+ __block__
611
+ i
612
+ 9
613
+ 5
614
+ 7
615
+ 0
616
+ 64
617
+ 47
618
+ 49
619
+ 1
620
+ 1
621
+ 11
622
+ I
623
+ 3
624
+ I
625
+ 0
626
+ I
627
+ 0
628
+ I
629
+ 0
630
+ I
631
+ -2
632
+ p
633
+ 2
634
+ s
635
+ 46
636
+ Please run `gem install yard` to install YARD.
637
+ x
638
+ 5
639
+ abort
640
+ p
641
+ 3
642
+ I
643
+ 0
644
+ I
645
+ 23
646
+ I
647
+ 9
648
+ x
649
+ 49
650
+ /Users/dustinwebber/source/ruby/unified2/Rakefile
651
+ p
652
+ 0
653
+ x
654
+ 3
655
+ doc
656
+ p
657
+ 55
658
+ I
659
+ 0
660
+ I
661
+ 1
662
+ I
663
+ 9
664
+ I
665
+ 2
666
+ I
667
+ 12
668
+ I
669
+ 5
670
+ I
671
+ 25
672
+ I
673
+ 6
674
+ I
675
+ 2e
676
+ I
677
+ 8
678
+ I
679
+ 50
680
+ I
681
+ 9
682
+ I
683
+ 5d
684
+ I
685
+ c
686
+ I
687
+ 5e
688
+ I
689
+ 9
690
+ I
691
+ 61
692
+ I
693
+ a
694
+ I
695
+ 6d
696
+ I
697
+ b
698
+ I
699
+ 82
700
+ I
701
+ f
702
+ I
703
+ 95
704
+ I
705
+ 10
706
+ I
707
+ 9e
708
+ I
709
+ 12
710
+ I
711
+ c2
712
+ I
713
+ 13
714
+ I
715
+ cf
716
+ I
717
+ 17
718
+ I
719
+ d0
720
+ I
721
+ 13
722
+ I
723
+ d3
724
+ I
725
+ 14
726
+ I
727
+ e8
728
+ I
729
+ 19
730
+ I
731
+ fe
732
+ I
733
+ 1a
734
+ I
735
+ 114
736
+ I
737
+ 1d
738
+ I
739
+ 127
740
+ I
741
+ 1e
742
+ I
743
+ 130
744
+ I
745
+ 20
746
+ I
747
+ 154
748
+ I
749
+ 21
750
+ I
751
+ 161
752
+ I
753
+ 25
754
+ I
755
+ 162
756
+ I
757
+ 21
758
+ I
759
+ 165
760
+ I
761
+ 22
762
+ I
763
+ 17a
764
+ I
765
+ 27
766
+ I
767
+ 192
768
+ x
769
+ 49
770
+ /Users/dustinwebber/source/ruby/unified2/Rakefile
771
+ p
772
+ 1
773
+ x
774
+ 1
775
+ e
@@ -19,7 +19,7 @@ end
19
19
  # The second argument is the last event processed by
20
20
  # the sensor. If the last_event_id column is blank in the
21
21
  # sensor table it will begin at the first available event.
22
- Unified2.watch('/var/log/snort/merged.log', :first) do |event|
22
+ Unified2.watch('seeds/unified2', :first) do |event|
23
23
  next if event.signature.blank?
24
24
 
25
25
  puts event.checksum # => 66302273aa2f181d0310aa789027bac3ce1efb4f
data/example/connect.rb CHANGED
@@ -13,8 +13,8 @@ class Connect
13
13
  :username => "rUnified2",
14
14
  :password => "password"
15
15
  })
16
- DataMapper.finalize
17
- DataMapper.auto_upgrade!
16
+ #DataMapper.finalize
17
+ #DataMapper.auto_upgrade!
18
18
  end
19
19
 
20
20
  end
data/example/models.rb CHANGED
@@ -6,8 +6,6 @@ class Event
6
6
 
7
7
  property :id, Serial, :index => true
8
8
 
9
- property :uid, String, :index => true
10
-
11
9
  property :event_id, Integer, :index => true
12
10
 
13
11
  property :sensor_id, Integer, :index => true
@@ -18,7 +18,6 @@ Unified2.configuration do
18
18
  load :signatures, 'seeds/sid-msg.map'
19
19
  load :generators, 'seeds/gen-msg.map'
20
20
  load :classifications, 'seeds/classification.config'
21
-
22
21
  end
23
22
 
24
23
  # Locate the sensor in the database using
@@ -49,7 +48,7 @@ Unified2.watch('/var/log/snort/merged.log', sensor.last_event_id + 1 || :first)
49
48
 
50
49
  insert_event = Event.new({
51
50
  :event_id => event.id,
52
- :uid => event.uid,
51
+ :checksum => event.checksum,
53
52
  :created_at => event.timestamp,
54
53
  :sensor_id => event.sensor.id,
55
54
  :source_ip => event.source_ip,
data/gemspec.yml CHANGED
@@ -7,7 +7,6 @@ email: dustin.webber@gmail.com
7
7
  homepage: https://github.com/mephux/unified2
8
8
 
9
9
  dependencies:
10
- gibbler: ~> 0.8.9
11
10
  bindata: ~> 1.3.1
12
11
  hexdump: ~> 0.1.0
13
12
 
@@ -1,15 +1,14 @@
1
- require 'gibbler'
2
- require 'ipaddr'
3
- require 'json'
4
1
  require 'unified2/classification'
5
2
  require 'unified2/payload'
6
3
  require 'unified2/sensor'
7
4
  require 'unified2/signature'
8
5
 
6
+ require 'ipaddr'
7
+ require 'json'
8
+
9
9
  module Unified2
10
10
 
11
11
  class Event
12
- include Gibbler::Complex
13
12
 
14
13
  attr_accessor :id, :metadata, :packet
15
14
 
@@ -23,9 +22,10 @@ module Unified2
23
22
  @timestamp = Time.at(@packet[:packet_second].to_i)
24
23
  end
25
24
  end
26
-
25
+
27
26
  def checksum
28
- gibbler
27
+ checkdum = [ip_source, ip_destination, signature.id, signature.generator, sensor.id, severity, classification.id]
28
+ Digest::MD5.hexdigest(checkdum.join(''))
29
29
  end
30
30
 
31
31
  def uid
@@ -237,7 +237,7 @@ data = %{
237
237
  def build_generator(event)
238
238
  if Unified2.generators.data
239
239
  if Unified2.generators.data.has_key?("#{event.data.generator_id}.#{event.data.signature_id}")
240
- sig = Unified2.generators["#{event.data.generator_id}.#{event.data.signature_id}"]
240
+ sig = Unified2.generators.data["#{event.data.generator_id}.#{event.data.signature_id}"]
241
241
 
242
242
  @event_hash[:signature] = {
243
243
  :signature_id => event.data.signature_id,
@@ -1,8 +1,7 @@
1
1
  module Unified2
2
2
  class Sensor
3
3
 
4
- attr_accessor :id, :hostname,
5
- :interface, :name
4
+ attr_accessor :id, :hostname, :interface, :name
6
5
 
7
6
  def initialize(options={})
8
7
  @id = options[:id] || 0
@@ -1,4 +1,4 @@
1
1
  module Unified2
2
2
  # unified2 version
3
- VERSION = "0.3.0"
3
+ VERSION = "0.3.1"
4
4
  end
data/lib/unified2.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  require 'bindata'
2
+ require 'digest'
2
3
  require 'socket'
3
4
  # http://cvs.snort.org/viewcvs.cgi/snort/src/output-plugins/spo_unified2.c?rev=1.3&content-type=text/vnd.viewcvs-markup
4
5
 
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: unified2
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.3.0
5
+ version: 0.3.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - Dustin Willis Webber
@@ -13,72 +13,61 @@ cert_chain: []
13
13
  date: 2011-03-14 00:00:00 -04:00
14
14
  default_executable:
15
15
  dependencies:
16
- - !ruby/object:Gem::Dependency
17
- name: gibbler
18
- prerelease: false
19
- requirement: &id001 !ruby/object:Gem::Requirement
20
- none: false
21
- requirements:
22
- - - ~>
23
- - !ruby/object:Gem::Version
24
- version: 0.8.9
25
- type: :runtime
26
- version_requirements: *id001
27
16
  - !ruby/object:Gem::Dependency
28
17
  name: bindata
29
18
  prerelease: false
30
- requirement: &id002 !ruby/object:Gem::Requirement
19
+ requirement: &id001 !ruby/object:Gem::Requirement
31
20
  none: false
32
21
  requirements:
33
22
  - - ~>
34
23
  - !ruby/object:Gem::Version
35
24
  version: 1.3.1
36
25
  type: :runtime
37
- version_requirements: *id002
26
+ version_requirements: *id001
38
27
  - !ruby/object:Gem::Dependency
39
28
  name: hexdump
40
29
  prerelease: false
41
- requirement: &id003 !ruby/object:Gem::Requirement
30
+ requirement: &id002 !ruby/object:Gem::Requirement
42
31
  none: false
43
32
  requirements:
44
33
  - - ~>
45
34
  - !ruby/object:Gem::Version
46
35
  version: 0.1.0
47
36
  type: :runtime
48
- version_requirements: *id003
37
+ version_requirements: *id002
49
38
  - !ruby/object:Gem::Dependency
50
39
  name: ore-tasks
51
40
  prerelease: false
52
- requirement: &id004 !ruby/object:Gem::Requirement
41
+ requirement: &id003 !ruby/object:Gem::Requirement
53
42
  none: false
54
43
  requirements:
55
44
  - - ~>
56
45
  - !ruby/object:Gem::Version
57
46
  version: "0.4"
58
47
  type: :development
59
- version_requirements: *id004
48
+ version_requirements: *id003
60
49
  - !ruby/object:Gem::Dependency
61
50
  name: rspec
62
51
  prerelease: false
63
- requirement: &id005 !ruby/object:Gem::Requirement
52
+ requirement: &id004 !ruby/object:Gem::Requirement
64
53
  none: false
65
54
  requirements:
66
55
  - - ~>
67
56
  - !ruby/object:Gem::Version
68
57
  version: "2.4"
69
58
  type: :development
70
- version_requirements: *id005
59
+ version_requirements: *id004
71
60
  - !ruby/object:Gem::Dependency
72
61
  name: yard
73
62
  prerelease: false
74
- requirement: &id006 !ruby/object:Gem::Requirement
63
+ requirement: &id005 !ruby/object:Gem::Requirement
75
64
  none: false
76
65
  requirements:
77
66
  - - ~>
78
67
  - !ruby/object:Gem::Version
79
68
  version: 0.6.0
80
69
  type: :development
81
- version_requirements: *id006
70
+ version_requirements: *id005
82
71
  description: A ruby interface for unified2 output. rUnified2 allows you to manipulate unified2 output for custom storage and/or analysis.
83
72
  email:
84
73
  - dustin.webber@gmail.com
@@ -98,6 +87,7 @@ files:
98
87
  - LICENSE.txt
99
88
  - README.rdoc
100
89
  - Rakefile
90
+ - Rakefile.compiled.rbc
101
91
  - example/basic-example.rb
102
92
  - example/connect.rb
103
93
  - example/models.rb
@@ -133,7 +123,7 @@ files:
133
123
  - spec/spec_helper.rb
134
124
  - spec/unified2_spec.rb
135
125
  - unified2.gemspec
136
- has_rdoc: yard
126
+ has_rdoc: true
137
127
  homepage: https://github.com/mephux/unified2
138
128
  licenses:
139
129
  - MIT
@@ -157,7 +147,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
157
147
  requirements: []
158
148
 
159
149
  rubyforge_project: unified2
160
- rubygems_version: 1.6.1
150
+ rubygems_version: 1.5.0
161
151
  signing_key:
162
152
  specification_version: 3
163
153
  summary: A ruby interface for unified2 output.