Sha256: 39434465fe1885f578777ce7c8d54658ddc95efd01130c091659cc34b8d716f3
Contents?: true
Size: 1.19 KB
Versions: 8
Compression:
Stored size: 1.19 KB
Contents
# frozen_string_literal: true module Mihari module Analyzers # # DNSTwister analyzer # class DNSTwister < Base include Concerns::Refangable # @return [String] attr_reader :type # # @param [String] query # @param [Hash, nil] options # def initialize(query, options: nil) super(refang(query), options:) @type = DataType.type(query) end def artifacts raise ValueError, "#{query}(type: #{type || "unknown"}) is not supported." unless valid_type? domains = client.fuzz(query) Parallel.map(domains) { |domain| resolvable?(domain) ? domain : nil }.compact end private # # Check whether a type is valid or not # # @return [Boolean] # def valid_type? type == "domain" end def client Clients::DNSTwister.new(timeout:) end # # Check whether a domain is resolvable or not # # @param [String] domain # # @return [Boolean] # def resolvable?(domain) Resolv.getaddress domain true rescue Resolv::ResolvError false end end end end
Version data entries
8 entries across 8 versions & 1 rubygems