Home page logo

nmap-dev logo Nmap Development mailing list archives

[RFC] [NSE] DNS library
From: "Philip Pickering" <pgpickering () gmail com>
Date: Tue, 12 Aug 2008 01:56:33 +0200


I've been working on a DNS library for NSE.

The most interesting function for you probably is

dns.query(dname, dtype, host, port, tries)

where all but the first arguments are optional:
* dname is the domain name to query
* dtype is the number of the DNS record type you want.
  Usually you use dns.types.* (e.g. dns.types.MX).
  It also accepts strings (e.g. "A", "PTR", ...) which it looks
  up in the dns.types table.
* host and port are the nameserver you want to ask
* tries is the number of tries, so it won't get into an
   infinite loop on circular references

It then tries to find a nice answer depending on the answer it
received and the DNS record type.

If no nameserver is given it tries to use the nameservers known
to Nmap. This works only if you apply the patch I attached,
which is against the current svn version (rev 9443).

For a reverse lookup you need dns.reverse(ip) to
prepare the IP address for a PTR query:

dns.query(dns.reverse(ip), dns.types.PTR))

One detail I'd like to change is instead of passing four optional
arguments to pass only one option table (maybe with some
more options, e.g. set "no recurse" option or omit trying to
format the answer).

Please test and comment.


Attachment: nse_dns.patch

Attachment: dns.lua

Sent through the nmap-dev mailing list
Archived at http://SecLists.Org

  By Date           By Thread  

Current thread:
[ Nmap | Sec Tools | Mailing Lists | Site News | About/Contact | Advertising | Privacy ]