Class: Mihari::Analyzers::Crtsh
- Inherits:
-
Base
- Object
- Mihari::Actor
- Base
- Mihari::Analyzers::Crtsh
- Defined in:
- lib/mihari/analyzers/crtsh.rb
Overview
crt.sh analyzer
Constant Summary
Constants included from Concerns::Retriable
Concerns::Retriable::DEFAULT_CONDITION, Concerns::Retriable::RETRIABLE_ERRORS
Instance Attribute Summary collapse
- #exclude_expired ⇒ Boolean readonly
- #match ⇒ String? readonly
Attributes inherited from Base
Attributes inherited from Mihari::Actor
Instance Method Summary collapse
- #artifacts ⇒ Object
-
#initialize(query, options: nil, exclude_expired: true, match: nil) ⇒ Crtsh
constructor
A new instance of Crtsh.
Methods inherited from Base
#call, from_query, #ignore_error?, inherited, #normalized_artifacts, #pagination_interval, #pagination_limit, #parallel?, #result, #truncated_query
Methods inherited from Mihari::Actor
#call, key, key_aliases, keys, #result, #retry_exponential_backoff, #retry_interval, #retry_times, #timeout, type, #validate_configuration!
Methods included from Concerns::Retriable
Methods included from Concerns::Configurable
#configuration_keys?, #configured?
Constructor Details
#initialize(query, options: nil, exclude_expired: true, match: nil) ⇒ Crtsh
Returns a new instance of Crtsh.
21 22 23 24 25 26 |
# File 'lib/mihari/analyzers/crtsh.rb', line 21 def initialize(query, options: nil, exclude_expired: true, match: nil) super(query, options: ) @exclude_expired = exclude_expired @match = match end |
Instance Attribute Details
#exclude_expired ⇒ Boolean (readonly)
10 11 12 |
# File 'lib/mihari/analyzers/crtsh.rb', line 10 def exclude_expired @exclude_expired end |
#match ⇒ String? (readonly)
13 14 15 |
# File 'lib/mihari/analyzers/crtsh.rb', line 13 def match @match end |
Instance Method Details
#artifacts ⇒ Object
28 29 30 31 32 33 34 |
# File 'lib/mihari/analyzers/crtsh.rb', line 28 def artifacts exclude = exclude_expired ? "expired" : nil client.search(query, exclude: exclude, match: match).map do |result| values = result["name_value"].to_s.lines.map(&:chomp).reject { |value| value.starts_with?("*.") } values.map { |value| Models::Artifact.new(data: value, metadata: result) } end.flatten end |