Created
June 3, 2018 23:37
-
-
Save ehsahil/4e751e7794c073e274b310747c815610 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
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