Home   >>   Nmap   >>   How To List Reverse DNS Records Of A Subnet
How To List Reverse DNS Records Of A Subnet PDF Print E-mail
( 2 Votes )
How To - Nmap
Written by Christian Foronda   
Monday, 27 September 2010 14:44

This script uses nmap to perform reverse DNS lookups on a subnet. It produces a list of IP addresses with the corresponding PTR record for a given subnet. You can enter the subnet in CDIR notation (i.e. /24 for a Class C)). You could add "--dns-servers x.x.x.x" after the "-sL" if you need the lookups to be performed on a specific DNS server.

	# vi scan-ptr
	#!/bin/bash

	NMAP="/usr/bin/nmap"

	NET=$1
	if [ "$NET" == "" ]; then 
	  echo 'Usage: scan-ptr IP/Subnet'
	  echo 'Sample: scan-ptr 192.168.1.54/27'
	  exit
	fi

	$NMAP -R -sL $NET | awk '{if($3=="not")print"("$2") no PTR";else print$3" is "$2}' | grep '('

Reference:
Credit to netsaint of commandlinefu.com




blog comments powered by Disqus
Last Updated on Monday, 27 September 2010 14:48