metasploit-framework

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

Ruby

Metasploit Framework

Net::DNS::Resolver#send

Performs a DNS query for the given name.  Neither the
searchlist nor the default domain will be appended.

The argument list can be either a Net::DNS::Packet object
or a name string plus optional type and class, which if
omitted default to +A+ and +IN+.

Returns a Net::DNS::Packet object.

  # Sending a +Packet+ object
  send_packet = Net::DNS::Packet.new("host.example.com",Net::DNS::NS,Net::DNS::HS)
  packet = res.send(send_packet)

  # Performing a query
  packet = res.send("host.example.com")
  packet = res.send("host.example.com",Net::DNS::NS)
  packet = res.send("host.example.com",Net::DNS::NS,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.send(ip)
  packet = res.send("192.168.10.254")

Use +packet.header.ancount+ or +packet.answer+ to find out if there
were any records in the answer section.

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


# Commit to git

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


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

hub pull-request


# Celebrate!