Created
February 12, 2009 02:34
-
-
Save astro/62454 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
#!/usr/bin/env ruby | |
HOSTS = %w(hummer astrom dn42 ldap wiefelspuetz astron icq www1 zardoz jabber1 debcache jabber2 unsafe dhcp kdc utur).map{ |s| "#{s}.hq.c3d2.de" } | |
=begin | |
Forward-resolves HOSTS and puts their IPv6 addresses suitable for BIND | |
reverse-lookup zonefiles. | |
=end | |
require 'resolv' | |
Resolv::DNS.open do |dns| | |
HOSTS.each do |host| | |
host += '.' unless host =~ /\.$/ | |
ress = dns.getresources host, Resolv::DNS::Resource::IN::AAAA | |
ress.each { |r| | |
addr = r.address.to_s | |
if `sipcalc -r #{addr}` =~ /^(.+?\.ip6\.arpa\.)$/ | |
puts "#{$1}\tIN PTR\t#{host}" | |
end | |
} | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment