Created
May 7, 2012 14:57
-
-
Save smarj/2628220 to your computer and use it in GitHub Desktop.
Naive reverse resolver
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 -wKU | |
require 'resolv' | |
while line = gets | |
ip = line.chomp | |
begin | |
host_name = Resolv.getname(ip) | |
rescue Resolv::ResolvError => error | |
host_name = "noname" | |
end | |
puts ip + ", " + host_name | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment