Scanning for Random DNS Servers

Nmap is such a useful tool. One neat feature is the ability to scan random IP addresses. Someone recently asked me if there was a way to discover random DNS servers.
sudo nmap -Pn -sS -p 53 -iR 1000 --open | grep -B 4 "53/tcp open"
That will invoke nmap to scan 1000 random IP addresses for an open TCP port 53. It pipes through grep to filter out the garbage (the -B option grabs 4 lines of output before the line that was grepped for).
blog comments powered by Disqus  -  Home