Class: Mihari::Analyzers::Base
Direct Known Subclasses
Basic, BinaryEdge, CIRCL, Censys, Crtsh, DNPedia, DNSTwister, FreeText, HTTPHash, OTX, Onyphe, PassiveDNS, PassiveSSL, PassiveTotal, Pulsedive, ReveseWhois, SSHFingerprint, SecurityTrails, SecurityTrailsDomainFeed, Shodan, Spyse, Urlscan, VirusTotal, ZoomEye
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Retriable
#retry_on_error
#config_keys, #configuration_values, #configured?
Constructor Details
#initialize ⇒ Base
Returns a new instance of Base.
13
14
15
16
|
# File 'lib/mihari/analyzers/base.rb', line 13
def initialize
@ignore_old_artifacts = false
@ignore_threshold = 0
end
|
Instance Attribute Details
#ignore_old_artifacts ⇒ Object
Returns the value of attribute ignore_old_artifacts.
11
12
13
|
# File 'lib/mihari/analyzers/base.rb', line 11
def ignore_old_artifacts
@ignore_old_artifacts
end
|
#ignore_threshold ⇒ Object
Returns the value of attribute ignore_threshold.
11
12
13
|
# File 'lib/mihari/analyzers/base.rb', line 11
def ignore_threshold
@ignore_threshold
end
|
Class Method Details
.inherited(child) ⇒ Object
56
57
58
|
# File 'lib/mihari/analyzers/base.rb', line 56
def self.inherited(child)
Mihari.analyzers << child
end
|
Instance Method Details
#artifacts ⇒ Array<String>, Array<Mihari::Artifact>
19
20
21
|
# File 'lib/mihari/analyzers/base.rb', line 19
def artifacts
raise NotImplementedError, "You must implement #{self.class}##{__method__}"
end
|
#description ⇒ String
29
30
31
|
# File 'lib/mihari/analyzers/base.rb', line 29
def description
raise NotImplementedError, "You must implement #{self.class}##{__method__}"
end
|
#run ⇒ Object
42
43
44
45
46
47
48
|
# File 'lib/mihari/analyzers/base.rb', line 42
def run
set_unique_artifacts
Parallel.each(valid_emitters) do |emitter|
run_emitter emitter
end
end
|
#run_emitter(emitter) ⇒ Object
50
51
52
53
54
|
# File 'lib/mihari/analyzers/base.rb', line 50
def run_emitter(emitter)
emitter.run(title: title, description: description, artifacts: unique_artifacts, source: source, tags: tags)
rescue StandardError => e
puts "Emission by #{emitter.class} is failed: #{e}"
end
|
#source ⇒ Object
33
34
35
|
# File 'lib/mihari/analyzers/base.rb', line 33
def source
self.class.to_s.split("::").last
end
|
38
39
40
|
# File 'lib/mihari/analyzers/base.rb', line 38
def tags
[]
end
|
#title ⇒ String
24
25
26
|
# File 'lib/mihari/analyzers/base.rb', line 24
def title
self.class.to_s.split("::").last
end
|