Class: Mihari::Enrichers::GooglePublicDNS

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

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

inherited

Methods included from Mixins::Configurable

#configuration_keys, #configuration_values, #configured?

Class Method Details

.query(name, resource_type) ⇒ Mihari::Structs::Shodan::GooglePublicDNS::Response?

Query Google Public DNS

Parameters:

  • name (String)
  • resource_type (String)

Returns:

  • (Mihari::Structs::Shodan::GooglePublicDNS::Response, nil)


22
23
24
25
26
27
28
29
30
31
32
# File 'lib/mihari/enrichers/google_public_dns.rb', line 22

def query(name, resource_type)
  url = "https://dns.google/resolve"
  params = { name: name, type: resource_type }
  res = HTTP.get(url, params: params)

  data = JSON.parse(res.body.to_s)

  Structs::GooglePublicDNS::Response.from_dynamic! data
rescue HTTPError
  nil
end

Instance Method Details

#valid?Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/mihari/enrichers/google_public_dns.rb', line 9

def valid?
  true
end