Skip to content

Instantly share code, notes, and snippets.

@zmack
Created March 5, 2011 18:07
Show Gist options
  • Save zmack/856557 to your computer and use it in GitHub Desktop.
Save zmack/856557 to your computer and use it in GitHub Desktop.
#!/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
@clyfe
Copy link

clyfe commented Mar 5, 2011

Cel mai popular server web intre primele n siteuri din primele 1M siteuri web (n dat in args)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment