Class: FIDIUS::PreludeDB::PreludeEvent
- Inherits:
-
Connection
- Object
- ActiveRecord::Base
- Connection
- FIDIUS::PreludeDB::PreludeEvent
- Defined in:
- lib/evasion-db/idmef-fetchers/prelude-db/lib/models/prelude_event.rb
Overview
Represents an IDMEF-Event which is distributed over multiple tables in PreludeManager
Class Method Summary collapse
- .column(name, sql_type = nil, default = nil, null = true) ⇒ Object
- .columns ⇒ Object
- .find(*args) ⇒ Object
- .find_by_sql(query) ⇒ Object
- .total_entries(options = nil) ⇒ Object
Instance Method Summary collapse
- #analyzer_model ⇒ Object
- #dest_ip ⇒ Object
- #dest_port ⇒ Object
- #detect_time ⇒ Object
- #id ⇒ Object
-
#initialize(prelude_alert) ⇒ PreludeEvent
constructor
A new instance of PreludeEvent.
- #inspect ⇒ Object
- #messageid ⇒ Object
- #payload ⇒ Object
- #severity ⇒ Object
- #source_ip ⇒ Object
- #source_port ⇒ Object
- #text ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(prelude_alert) ⇒ PreludeEvent
Returns a new instance of PreludeEvent.
13 14 15 |
# File 'lib/evasion-db/idmef-fetchers/prelude-db/lib/models/prelude_event.rb', line 13 def initialize(prelude_alert) @prelude_alert = prelude_alert end |
Class Method Details
.column(name, sql_type = nil, default = nil, null = true) ⇒ Object
7 8 9 |
# File 'lib/evasion-db/idmef-fetchers/prelude-db/lib/models/prelude_event.rb', line 7 def self.column(name, sql_type=nil, default=nil,null=true) columns << ActiveRecord::ConnectionAdapters::Column.new(name.to_s,default,sql_type.to_s,null) end |
.columns ⇒ Object
6 |
# File 'lib/evasion-db/idmef-fetchers/prelude-db/lib/models/prelude_event.rb', line 6 def self.columns() @columns ||= []; end |
.find(*args) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/evasion-db/idmef-fetchers/prelude-db/lib/models/prelude_event.rb', line 25 def self.find(*args) if args[0].is_a? Numeric a = Alert.find(:all, :conditions => [ "_ident = ?", args[0] ]) return PreludeEvent.new a.first else case args[0] when :all if args[1] if(args[1][:conditions] == nil) args[1] = args[1].merge({:joins => [:detect_time,]}) args[1] = args[1].merge({:order => 'time DESC'}) end end a = Alert.find(*args) result = Array.new a.each do |pa| result.push PreludeEvent.new pa end return result when :first a = Alert.first return PreludeEvent.new a when :last a = Alert.last return PreludeEvent.new a else end end end |
.find_by_sql(query) ⇒ Object
17 18 19 |
# File 'lib/evasion-db/idmef-fetchers/prelude-db/lib/models/prelude_event.rb', line 17 def self.find_by_sql(query) end |
.total_entries(options = nil) ⇒ Object
21 22 23 |
# File 'lib/evasion-db/idmef-fetchers/prelude-db/lib/models/prelude_event.rb', line 21 def self.total_entries( = nil) return Alert.total_entries end |
Instance Method Details
#analyzer_model ⇒ Object
92 93 94 95 |
# File 'lib/evasion-db/idmef-fetchers/prelude-db/lib/models/prelude_event.rb', line 92 def analyzer_model return @prelude_alert.analyzer.name.to_s unless @prelude_alert.nil? return "No Ref" end |
#dest_ip ⇒ Object
61 62 63 64 |
# File 'lib/evasion-db/idmef-fetchers/prelude-db/lib/models/prelude_event.rb', line 61 def dest_ip return @prelude_alert.dest_ip unless @prelude_alert.nil? return "No Ref" end |
#dest_port ⇒ Object
71 72 73 74 |
# File 'lib/evasion-db/idmef-fetchers/prelude-db/lib/models/prelude_event.rb', line 71 def dest_port return @prelude_alert.dest_port.port unless @prelude_alert.nil? return "No Ref" end |
#detect_time ⇒ Object
80 81 82 83 |
# File 'lib/evasion-db/idmef-fetchers/prelude-db/lib/models/prelude_event.rb', line 80 def detect_time return @prelude_alert.detect_time.time unless @prelude_alert.nil? return "No Ref" end |
#id ⇒ Object
97 98 99 100 |
# File 'lib/evasion-db/idmef-fetchers/prelude-db/lib/models/prelude_event.rb', line 97 def id return @prelude_alert._ident unless @prelude_alert.nil? return "No Ref" end |
#inspect ⇒ Object
102 103 104 105 106 107 108 |
# File 'lib/evasion-db/idmef-fetchers/prelude-db/lib/models/prelude_event.rb', line 102 def inspect begin return "PreludeEvent id: "+id.to_s+", source_ip: "+source_ip+" dest_ip: "+dest_ip+" severity: "+severity+" text: "+text+" analyzer_model: "+analyzer_model+" detect_time: "+detect_time.to_s+"" rescue puts $!.+":"+$!.backtrace.to_s end end |
#messageid ⇒ Object
114 115 116 117 |
# File 'lib/evasion-db/idmef-fetchers/prelude-db/lib/models/prelude_event.rb', line 114 def return @prelude_alert. unless @prelude_alert.nil? return "No Ref" end |
#payload ⇒ Object
76 77 78 |
# File 'lib/evasion-db/idmef-fetchers/prelude-db/lib/models/prelude_event.rb', line 76 def payload return @prelude_alert.payload_data unless @prelude_alert.nil? end |
#severity ⇒ Object
88 89 90 91 |
# File 'lib/evasion-db/idmef-fetchers/prelude-db/lib/models/prelude_event.rb', line 88 def severity return @prelude_alert.severity unless @prelude_alert.nil? return "No Ref" end |
#source_ip ⇒ Object
56 57 58 59 |
# File 'lib/evasion-db/idmef-fetchers/prelude-db/lib/models/prelude_event.rb', line 56 def source_ip return @prelude_alert.source_ip unless @prelude_alert.nil? return "No Ref" end |
#source_port ⇒ Object
66 67 68 69 |
# File 'lib/evasion-db/idmef-fetchers/prelude-db/lib/models/prelude_event.rb', line 66 def source_port return @prelude_alert.source_port.port unless @prelude_alert.nil? return "No Ref" end |
#text ⇒ Object
84 85 86 87 |
# File 'lib/evasion-db/idmef-fetchers/prelude-db/lib/models/prelude_event.rb', line 84 def text return @prelude_alert.classification.text unless @prelude_alert.nil? return "No Ref" end |
#to_s ⇒ Object
110 111 112 |
# File 'lib/evasion-db/idmef-fetchers/prelude-db/lib/models/prelude_event.rb', line 110 def to_s "#{text}: #{source_ip}:#{source_port} -> #{dest_ip}:#{dest_port}" end |