Created
March 5, 2011 18:07
-
-
Save zmack/856557 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 'net/http' | |
def get_server(site) | |
Net::HTTP.start(site, 80) do |http| | |
response = http.head('/') | |
response['server'] | |
end | |
rescue Exception => e | |
"[!] #{e.message}" | |
end | |
def get_csv | |
`wget http://s3.amazonaws.com/alexa-static/top-1m.csv.zip && unzip top-1m.csv.zip` | |
end | |
sites = (ARGV.first || 20).to_i | |
get_csv unless File.exist?('top-1m.csv') | |
File.open('top-1m.csv') do |file| | |
file.each_line do |line| | |
site = line.gsub(/.*,/,'').chop | |
print "[#{file.lineno}]. #{site} - " | |
puts get_server(site) | |
break if file.lineno == sites | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Cel mai popular server web intre primele n siteuri din primele 1M siteuri web (n dat in args)