metasploit-framework

https://github.com/rapid7/metasploit-framework

Ruby

Metasploit Framework

Net::DNS::Resolver#initialize

Create a new resolver object.

Argument +config+ can either be empty or be an hash with
some configuration parameters. To know what each parameter
do, look at the description of each.
Some example:

  # Use the sistem defaults
  res = Net::DNS::Resolver.new

  # Specify a configuration file
  res = Net::DNS::Resolver.new(:config_file => '/my/dns.conf')

  # Set some option
  res = Net::DNS::Resolver.new(:nameservers => "172.16.1.1",
                               :recursive => false,
                               :retry => 10)

===Config file

Net::DNS::Resolver uses a config file to read the usual
values a resolver needs, such as nameserver list and
domain names. On UNIX systems the defaults are read from the
following files, in the order indicated:

* /etc/resolv.conf
* $HOME/.resolv.conf
* ./.resolv.conf

The following keywords are recognized in resolver configuration files:

* domain: the default domain.
* search: a space-separated list of domains to put in the search list.
* nameserver: a space-separated list of nameservers to query.

Files except for /etc/resolv.conf must be owned by the effective userid
running the program or they won't be read.  In addition, several environment
variables can also contain configuration information; see Environment
in the main description for Resolver class.

On Windows Systems, an attempt is made to determine the system defaults
using the registry.  This is still a work in progress; systems with many
dynamically configured network interfaces may confuse Net::DNS.

You can include a configuration file of your own when creating a resolver
object:

  # Use my own configuration file
  my $res = Net::DNS::Resolver->new(config_file => '/my/dns.conf');

This is supported on both UNIX and Windows.  Values pulled from a custom
configuration file override the the system's defaults, but can still be
overridden by the other arguments to Resolver::new.

Explicit arguments to Resolver::new override both the system's defaults
and the values of the custom configuration file, if any.

===Parameters

The following arguments to Resolver::new are supported:

- nameservers: an array reference of nameservers to query.
- searchlist:  an array reference of domains.
- recurse
- debug
- domain
- port
- srcaddr
- srcport
- tcp_timeout
- udp_timeout
- retrans
- retry
- usevc
- stayopen
- igntc
- defnames
- dnsrch
- persistent_tcp
- persistent_udp
- dnssec

For more information on any of these options, please consult the
method of the same name.

===Disclaimer

Part of the above documentation is taken from the one in the
Net::DNS::Resolver Perl module.

Source | Google | Stack overflow

Edit

git clone [email protected]:rapid7/metasploit-framework.git

cd metasploit-framework

open lib/net/dns/resolver.rb

Contribute

# Make a new branch

git checkout -b -your-name--update-docs-Net--DNS--Resolver-initialize-for-pr


# Commit to git

git add lib/net/dns/resolver.rbgit commit -m "better docs for Net::DNS::Resolver#initialize"


# Open pull request

gem install hub # on a mac you can `brew install hub`

hub fork

git push <your name> -your-name--update-docs-Net--DNS--Resolver-initialize-for-pr

hub pull-request


# Celebrate!