Class: Mihari::Analyzers::Base
- Inherits:
-
Object
- Object
- Mihari::Analyzers::Base
show all
- Defined in:
- lib/mihari/analyzers/base.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize ⇒ Base
Returns a new instance of Base.
8
9
10
|
# File 'lib/mihari/analyzers/base.rb', line 8
def initialize
@the_hive = TheHive.new
end
|
Instance Attribute Details
#the_hive ⇒ Object
Returns the value of attribute the_hive.
6
7
8
|
# File 'lib/mihari/analyzers/base.rb', line 6
def the_hive
@the_hive
end
|
Instance Method Details
#artifacts ⇒ Array<String>, Array<Mihari::Artifact>
13
14
15
|
# File 'lib/mihari/analyzers/base.rb', line 13
def artifacts
raise NotImplementedError, "You must implement #{self.class}##{__method__}"
end
|
#description ⇒ String
23
24
25
|
# File 'lib/mihari/analyzers/base.rb', line 23
def description
raise NotImplementedError, "You must implement #{self.class}##{__method__}"
end
|
#run ⇒ Object
32
33
34
35
36
37
38
39
|
# File 'lib/mihari/analyzers/base.rb', line 32
def run
Mihari.emitters.each do |emitter_class|
emitter = emitter_class.new
next unless emitter.valid?
run_emitter emitter
end
end
|
#run_emitter(emitter) ⇒ Object
41
42
43
44
45
|
# File 'lib/mihari/analyzers/base.rb', line 41
def run_emitter(emitter)
emitter.emit(title: title, description: description, artifacts: unique_artifacts, tags: tags)
rescue StandardError => e
puts "Emission by #{emitter.class} is failed: #{e}"
end
|
28
29
30
|
# File 'lib/mihari/analyzers/base.rb', line 28
def tags
[]
end
|
#title ⇒ String
18
19
20
|
# File 'lib/mihari/analyzers/base.rb', line 18
def title
self.class.to_s.split("::").last
end
|