box-o-sand/cookbook/014/04-list-oreilly-mx-ns.rb
2011-07-25 22:36:02 -04:00

12 lines
274 B
Ruby

require 'resolv'
dns = Resolv::DNS.new
domain = "oreilly.com"
dns.each_resource(domain, Resolv::DNS::Resource::IN::MX) do |mail_server|
puts mail_server.exchange
end
dns.each_resource(domain, Resolv::DNS::Resource::IN::NS) do |nameserver|
puts nameserver.name
end