metasploit-framework

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

Ruby

Metasploit Framework

Net::DNS::Resolver#query

Performs a DNS query for the given name; the search list
is not applied.  If the name doesn't contain any dots and
+defname+ is true then the default domain will be appended.

The record type and class can be omitted; they default to +A+
and +IN+.  If the name looks like an IP address (IPv4 or IPv6),
then an appropriate PTR query will be performed.

  packet = res.query('mailhost')
  packet = res.query('mailhost.example.com')
  packet = res.query('example.com', Net::DNS::MX)
  packet = res.query('user.passwd.example.com', Net::DNS::TXT, Net::DNS::HS)

If the name is an IP address (Ipv4 or IPv6), in the form of a string
or a +IPAddr+ object, then an appropriate PTR query will be performed:

  ip = IPAddr.new("172.16.100.2")
  packet = res.query(ip)
  packet = res.query("192.168.10.254")

Returns a Net::DNS::Packet object. If you need to examine the response
packet whether it contains any answers or not, use the Resolver#send
method instead.

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-query-for-pr


# Commit to git

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


# 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-query-for-pr

hub pull-request


# Celebrate!