Created
June 14, 2015 18:54
-
-
Save gr33n7007h/903cb84de086e068ac09 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 | |
require 'socket' | |
def random_hostnames | |
loop do | |
begin | |
octets = Array.new(4) { rand(255) } | |
hostname = Socket.gethostbyaddr(octets.pack('C4')).first | |
puts "IP: #{octets.join('.')} -> Hostname: #{hostname}" | |
rescue SocketError | |
next | |
end | |
end | |
end | |
random_hostnames |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment