Class: Mihari::Analyzers::Crtsh

Inherits:
Base
  • Object
show all
Defined in:
lib/mihari/analyzers/crtsh.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#ignore_old_artifacts, #ignore_threshold

Instance Method Summary collapse

Methods inherited from Base

inherited, #run, #run_emitter, #source

Methods included from Retriable

#retry_on_error

Methods included from Configurable

#config_keys, #configuration_values, #configured?

Constructor Details

#initialize(query, title: nil, description: nil, tags: [], exclude_expired: nil) ⇒ Crtsh

Returns a new instance of Crtsh.



10
11
12
13
14
15
16
17
18
19
# File 'lib/mihari/analyzers/crtsh.rb', line 10

def initialize(query, title: nil, description: nil, tags: [], exclude_expired: nil)
  super()

  @query = query
  @title = title || "crt.sh lookup"
  @description = description || "query = #{query}"
  @tags = tags

  @exclude_expired = exclude_expired.nil? ? true : exclude_expired
end

Instance Attribute Details

#descriptionObject (readonly)

Returns the value of attribute description.



8
9
10
# File 'lib/mihari/analyzers/crtsh.rb', line 8

def description
  @description
end

#exclude_expiredObject (readonly)

Returns the value of attribute exclude_expired.



8
9
10
# File 'lib/mihari/analyzers/crtsh.rb', line 8

def exclude_expired
  @exclude_expired
end

#queryObject (readonly)

Returns the value of attribute query.



8
9
10
# File 'lib/mihari/analyzers/crtsh.rb', line 8

def query
  @query
end

#tagsObject (readonly)

Returns the value of attribute tags.



8
9
10
# File 'lib/mihari/analyzers/crtsh.rb', line 8

def tags
  @tags
end

#titleObject (readonly)

Returns the value of attribute title.



8
9
10
# File 'lib/mihari/analyzers/crtsh.rb', line 8

def title
  @title
end

Instance Method Details

#artifactsObject



21
22
23
24
25
# File 'lib/mihari/analyzers/crtsh.rb', line 21

def artifacts
  results = search
  name_values = results.map { |result| result["name_value"] }.compact
  name_values.map(&:lines).flatten.uniq.map(&:chomp)
end