Skip to content

Instantly share code, notes, and snippets.

@ehsahil
Created June 3, 2018 23:37
Show Gist options
  • Save ehsahil/4e751e7794c073e274b310747c815610 to your computer and use it in GitHub Desktop.
Save ehsahil/4e751e7794c073e274b310747c815610 to your computer and use it in GitHub Desktop.
require 'socket'
require 'colorize'
begin
file = File.open(ARGV[0], "r")
rescue
puts "Usage: ruby resolve.rb filename (where filename contains a list of domains)"
exit
end
file.each_line do |subdomain|
begin
color = :green
ip = IPSocket::getaddress(subdomain.strip)
rescue
color = :red
ip = "unknown"
end
puts "#{subdomain}: #{ip}".colorize(color)
system("nmap -F #{ip}") unless ip.eql?("unknown")
puts
puts "+-----------------------------------------------------------------------------------+"
puts
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment