rbroccoli 1.1.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.
- data/MIT-LICENSE +21 -0
- data/README +40 -0
- data/data/bro/callback-typemaps.yml +1010 -0
- data/data/bro/record-typemaps.yml +332 -0
- data/ext/broccoli_ext/autogen.sh +3 -0
- data/ext/broccoli_ext/broccoli.i +463 -0
- data/ext/broccoli_ext/broccoli_wrap.c +4213 -0
- data/ext/broccoli_ext/extconf.rb +15 -0
- data/ext/broccoli_ext/post-clean.rb +3 -0
- data/ext/broccoli_ext/pre-config.rb +5 -0
- data/ext/broccoli_ext/test/broconftest.rb +12 -0
- data/ext/broccoli_ext/test/test.rb +174 -0
- data/lib/Bro/connection.rb +73 -0
- data/lib/Bro/event.rb +34 -0
- data/lib/Bro/record.rb +60 -0
- data/lib/Bro/typemap.rb +158 -0
- data/lib/bro.rb +105 -0
- metadata +64 -0
data/lib/bro.rb
ADDED
@@ -0,0 +1,105 @@
|
|
1
|
+
require 'broccoli_ext'
|
2
|
+
require 'time'
|
3
|
+
|
4
|
+
require 'bro/connection'
|
5
|
+
require 'bro/event'
|
6
|
+
require 'bro/record'
|
7
|
+
require 'bro/typemap'
|
8
|
+
|
9
|
+
class Broccoli_ext::BroPort
|
10
|
+
@@protocols = {0=>'ip', 1=>'icmp', 2=>'igmp', 3=>'ggp', 4=>'ipv4',
|
11
|
+
6=>'tcp', 7=>'st', 8=>'egp', 9=>'pigp', 10=>'rccmon',
|
12
|
+
11=>'nvpii', 12=>'pup', 13=>'argus', 14=>'emcon',
|
13
|
+
15=>'xnet', 16=>'chaos', 17=>'udp', 18=>'mux', 19=>'meas',
|
14
|
+
20=>'hmp', 21=>'prm', 22=>'idp', 23=>'trunk1', 24=>'trunk2',
|
15
|
+
25=>'leaf1', 26=>'leaf2', 27=>'rdp', 28=>'irtp', 29=>'tp',
|
16
|
+
30=>'blt', 31=>'nsp', 32=>'inp', 33=>'sep', 34=>'3pc',
|
17
|
+
35=>'idpr', 36=>'xtp', 37=>'ddp', 38=>'cmtp', 39=>'tpxx',
|
18
|
+
40=>'il', 41=>'ipv6', 42=>'sdrp', 43=>'routing',
|
19
|
+
44=>'fragment', 45=>'idrp', 46=>'rsvp', 47=>'gre', 48=>'mhrp',
|
20
|
+
49=>'bha', 50=>'esp', 51=>'ah', 52=>'inlsp', 53=>'swipe',
|
21
|
+
54=>'nhrp', 58=>'icmpv6', 59=>'nonext', 60=>'dstopts',
|
22
|
+
61=>'ahip', 62=>'cftp', 63=>'hello', 64=>'satexpak',
|
23
|
+
65=>'kryptolan', 66=>'rvd', 67=>'ippc', 68=>'adfs',
|
24
|
+
69=>'satmon', 70=>'visa', 71=>'ipcv', 72=>'cpnx', 73=>'cphb',
|
25
|
+
74=>'wsn', 75=>'pvp', 76=>'brsatmon', 77=>'nd', 78=>'wbmon',
|
26
|
+
79=>'wbexpak', 80=>'eon', 81=>'vmtp', 82=>'svmtp',
|
27
|
+
83=>'vines', 84=>'ttp', 85=>'igp', 86=>'dgp', 87=>'tcf',
|
28
|
+
88=>'igrp', 89=>'ospfigp', 90=>'srpc', 91=>'larp', 92=>'mtp',
|
29
|
+
93=>'ax25', 94=>'ipeip', 95=>'micp', 96=>'sccsp',
|
30
|
+
97=>'etherip', 98=>'encap', 99=>'apes', 100=>'gmtp',
|
31
|
+
103=>'pim', 108=>'ipcomp', 113=>'pgm', 254=>'divert',
|
32
|
+
255=>'raw'}
|
33
|
+
def to_s
|
34
|
+
"#{port_num}/#{@@protocols[port_proto]}"
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
# This gives a nice interface for retrieving fields from records and connections
|
39
|
+
module SWIG
|
40
|
+
|
41
|
+
class TYPE_p_bro_conn
|
42
|
+
def method_missing(meth, *args)
|
43
|
+
return bro_conn_data_get(self, meth.id2name)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
class TYPE_p_bro_record
|
48
|
+
attr_accessor :from_callback
|
49
|
+
attr_accessor :arg_num
|
50
|
+
attr_accessor :record_type
|
51
|
+
|
52
|
+
# .id is a method for all ruby objects. Move it out of the way for records.
|
53
|
+
alias :old_id :id
|
54
|
+
def id
|
55
|
+
return method_missing(:id)
|
56
|
+
end
|
57
|
+
|
58
|
+
# TODO: this is an utter mess, make it less so.
|
59
|
+
def method_missing(meth, *args)
|
60
|
+
if @from_callback and @arg_num
|
61
|
+
name_type, int_type = Bro::Typemap.get(:callback, @from_callback, @arg_num)
|
62
|
+
#puts "(:record, #{name_type}, #{meth.id2name})"
|
63
|
+
name_type, int_type = Bro::Typemap.get(:record, name_type, meth.id2name)
|
64
|
+
rec = Broccoli_ext::bro_record_get_named_val(self, meth.id2name, int_type)
|
65
|
+
elsif @record_type
|
66
|
+
name_type, int_type = Bro::Typemap.get(:record, @record_type, meth.id2name)
|
67
|
+
rec = Broccoli_ext::bro_record_get_named_val(self, meth.id2name, int_type)
|
68
|
+
else
|
69
|
+
puts "oops.. something screwed up in #{__FILE__} around line #{__LINE__}"
|
70
|
+
end
|
71
|
+
if int_type == Broccoli_ext::BRO_TYPE_RECORD
|
72
|
+
rec.record_type = name_type
|
73
|
+
end
|
74
|
+
return rec
|
75
|
+
end
|
76
|
+
|
77
|
+
# TODO: Getting values from record by position doesn't work yet.
|
78
|
+
# I need to find a good way to determine type of value.
|
79
|
+
# I don't think that records are neccesarily stored in
|
80
|
+
# the same order that they are defined in the bro.init file.
|
81
|
+
#def [](pos)
|
82
|
+
# Bro::Typemap.get(:record)[self.record_type]
|
83
|
+
# return Broccoli_ext::bro_record_get_nth_val(self, @arg_num, BRO_TYPE_STRING)
|
84
|
+
#end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
|
89
|
+
module Bro
|
90
|
+
def Bro.current_time_f
|
91
|
+
Broccoli_ext::bro_util_current_time
|
92
|
+
end
|
93
|
+
|
94
|
+
def Bro.current_time
|
95
|
+
Time.at( current_time_f() )
|
96
|
+
end
|
97
|
+
|
98
|
+
def Bro.debug_calltrace(v)
|
99
|
+
Broccoli_ext::bro_debug_calltrace=v
|
100
|
+
end
|
101
|
+
|
102
|
+
def Bro.debug_messages(v)
|
103
|
+
Broccoli_ext::bro_debug_messages=v
|
104
|
+
end
|
105
|
+
end
|
metadata
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
rubygems_version: 0.8.11
|
3
|
+
specification_version: 1
|
4
|
+
name: rbroccoli
|
5
|
+
version: !ruby/object:Gem::Version
|
6
|
+
version: 1.1.0
|
7
|
+
date: 2006-08-22 00:00:00 -04:00
|
8
|
+
summary: Interface for the Bro Intrusion Detection System.
|
9
|
+
require_paths:
|
10
|
+
- lib
|
11
|
+
email: seth@net.ohio-state.edu
|
12
|
+
homepage: http://rbroccoli.rubyforge.org
|
13
|
+
rubyforge_project: rbroccoli
|
14
|
+
description:
|
15
|
+
autorequire: bro
|
16
|
+
default_executable:
|
17
|
+
bindir: bin
|
18
|
+
has_rdoc: false
|
19
|
+
required_ruby_version: !ruby/object:Gem::Version::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">"
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 0.0.0
|
24
|
+
version:
|
25
|
+
platform: ruby
|
26
|
+
signing_key:
|
27
|
+
cert_chain:
|
28
|
+
authors:
|
29
|
+
- Seth Hall
|
30
|
+
files:
|
31
|
+
- lib/bro.rb
|
32
|
+
- lib/Bro/connection.rb
|
33
|
+
- lib/Bro/event.rb
|
34
|
+
- lib/Bro/record.rb
|
35
|
+
- lib/Bro/typemap.rb
|
36
|
+
- data/bro
|
37
|
+
- data/bro/callback-typemaps.yml
|
38
|
+
- data/bro/record-typemaps.yml
|
39
|
+
- README
|
40
|
+
- ext/broccoli_ext
|
41
|
+
- ext/broccoli_ext/autogen.sh
|
42
|
+
- ext/broccoli_ext/broccoli.i
|
43
|
+
- ext/broccoli_ext/broccoli_wrap.c
|
44
|
+
- ext/broccoli_ext/extconf.rb
|
45
|
+
- ext/broccoli_ext/post-clean.rb
|
46
|
+
- ext/broccoli_ext/pre-config.rb
|
47
|
+
- ext/broccoli_ext/test
|
48
|
+
- ext/broccoli_ext/test/broconftest.rb
|
49
|
+
- ext/broccoli_ext/test/test.rb
|
50
|
+
- MIT-LICENSE
|
51
|
+
test_files: []
|
52
|
+
|
53
|
+
rdoc_options: []
|
54
|
+
|
55
|
+
extra_rdoc_files: []
|
56
|
+
|
57
|
+
executables: []
|
58
|
+
|
59
|
+
extensions:
|
60
|
+
- ext/broccoli_ext/extconf.rb
|
61
|
+
requirements: []
|
62
|
+
|
63
|
+
dependencies: []
|
64
|
+
|