Class: Mihari::Enrichers::GooglePublicDNS

Inherits:
Base
  • Object
show all
Defined in:
lib/mihari/enrichers/google_public_dns.rb

Overview

Google Public DNS enricher

Constant Summary

Constants included from Concerns::Retriable

Concerns::Retriable::DEFAULT_CONDITION, Concerns::Retriable::RETRIABLE_ERRORS

Instance Attribute Summary

Attributes inherited from Actor

#options

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#callable?, inherited, #initialize, #result

Methods inherited from Actor

configuration_keys, #initialize, key_aliases, keys, #result, #retry_exponential_backoff, #retry_interval, #retry_times, #timeout, type, #validate_configuration!

Methods included from Concerns::Retriable

#retry_on_error

Methods included from Concerns::Configurable

#configuration_keys?, #configured?

Constructor Details

This class inherits a constructor from Mihari::Enrichers::Base

Class Method Details

.keyString

Returns:

  • (String)


32
33
34
# File 'lib/mihari/enrichers/google_public_dns.rb', line 32

def key
  "google_public_dns"
end

Instance Method Details

#call(artifact) ⇒ Mihari::Models::Artifact

Parameters:

Returns:



14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/mihari/enrichers/google_public_dns.rb', line 14

def call(artifact)
  return if artifact.domain.nil?

  res = client.query_all(artifact.domain)

  artifact.tap do |tapped|
    if tapped.dns_records.empty?
      tapped.dns_records = res.answers.map do |answer|
        Models::DnsRecord.new(resource: answer.resource_type, value: answer.data)
      end
    end
  end
end