Sha256: a174a98e030fe3bac57e5fe29e93b0b8c1a5884444e5f2dcc9327fd1b1719e77
Contents?: true
Size: 1.22 KB
Versions: 3
Compression:
Stored size: 1.22 KB
Contents
# frozen_string_literal: true module Mihari module Enrichers # # Google Public DNS enricher # class GooglePublicDNS < Base # # Query Google Public DNS # # @param [String] name # # @return [Array<Mihari::Structs::GooglePublicDNS::Response>] # def call(name) %w[A AAAA CNAME TXT NS].filter_map do |resource_type| query_by_type(name, resource_type) end end # # Query Google Public DNS by resource type # # @param [String] name # @param [String] resource_type # # @return [Mihari::Structs::GooglePublicDNS::Response, nil] # def query_by_type(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 class << self # # @return [String] # def class_key "google_public_dns" end end private def http HTTP::Factory.build timeout: timeout end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
mihari-5.7.2 | lib/mihari/enrichers/google_public_dns.rb |
mihari-5.7.1 | lib/mihari/enrichers/google_public_dns.rb |
mihari-5.7.0 | lib/mihari/enrichers/google_public_dns.rb |