Created
March 1, 2012 10:18
-
-
Save thesp0nge/1948761 to your computer and use it in GitHub Desktop.
Content-Type enumerator
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 'net/http' | |
require 'rainbow' | |
url_list = File.open(ARGV[0], 'r').readlines | |
if url_list.nil? | |
puts "aiee: missing url list".color(:red) | |
end | |
url_list.each do |url| | |
response = nil | |
uri = URL(url) | |
Net::HTTP.start(uri.host, url.port) {|http| | |
response = http.head('/'+uri.request_uri.chomp) | |
printf "/#{uri.request_uri.chomp}: ".color(:white) | |
printf "#{response['content-type']}\n".color(:yellow) | |
} | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment