Class: Ronin::CLI::Commands::Dns Private

Inherits:
ValueProcessorCommand show all
Includes:
DNS
Defined in:
lib/ronin/cli/commands/dns.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Queries DNS records for the given host name.

Usage

ronin dns [options] {HOST ... | --file FILE}

Options

-f, --file FILE                  Optional file to read values from
-N, --nameserver IP              Send DNS queries to the nameserver
-t A|AAAA|ANY|CNAME|HINFO|LOC|MINFO|MX|NS|PTR|SOA|SRV|TXT|WKS,
    --type                       Queries a specific type of DNS record
-h, --help                       Print help information

Arguments

HOST                             The host name to query

Since:

  • 2.0.0

Constant Summary

Constants included from DNS

DNS::RECORD_TYPES

Instance Attribute Summary

Attributes included from DNS

#nameservers

Attributes inherited from ValueProcessorCommand

#files

Instance Method Summary collapse

Methods included from DNS

included, #initialize, #print_record, #print_records, #resolver

Methods inherited from ValueProcessorCommand

#initialize, #process_file, #run

Instance Method Details

#process_value(host) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Queries the given host.

Parameters:

  • host (String)

Since:

  • 2.0.0



69
70
71
# File 'lib/ronin/cli/commands/dns.rb', line 69

def process_value(host)
  print_records(query_records(host))
end

#query_records(host) ⇒ Array<Resolv::DNS::Resource>

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Queries the records for the given host name.

Parameters:

  • host (String)

    The host name to query.

Returns:

  • (Array<Resolv::DNS::Resource>)

    The returned DNS resource records.

Since:

  • 2.0.0



82
83
84
85
86
87
88
# File 'lib/ronin/cli/commands/dns.rb', line 82

def query_records(host)
  if options[:type]
    resolver.get_records(host,options[:type].downcase)
  else
    resolver.get_a_records(host) + resolver.get_aaaa_records(host)
  end
end