Created
February 27, 2010 18:08
-
-
Save darron/316856 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
# sudo gem install whois # http://www.ruby-whois.org/ | |
require 'whois' | |
# From your named configuration files: | |
# egrep -r zone * | cut -d ' ' -f 2 | cut -d '"' -f 2 | sort | uniq > domains.txt | |
File.open("domains.txt", "r") do |infile| | |
while (line = infile.gets) | |
puts "Domain: #{line}" | |
begin | |
a = Whois.whois("#{line}") | |
rescue | |
puts "Timeout." | |
end | |
# Some whois servers don't support nameserver query. | |
# most notably .ca domains. | |
begin | |
a.nameservers.each do |nameserver| | |
puts nameserver | |
end | |
rescue | |
whois_data = `/usr/bin/whois #{line}` | |
puts whois_data | |
end | |
puts "" | |
# Sleep lots otherwise people start to block us. | |
sleep 5 | |
end | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment