Skip to content

Instantly share code, notes, and snippets.

/ruby.rb Secret

Created October 10, 2017 08:19
Show Gist options
  • Save anonymous/614986280ca3d8c548398da812867dd7 to your computer and use it in GitHub Desktop.
Save anonymous/614986280ca3d8c548398da812867dd7 to your computer and use it in GitHub Desktop.
require 'rexml/document'
require 'net/http'
require 'uri'
require 'getoptlong'
require 'fileutils'
require 'optparse'
require 'csv'
if ARGV.length != 1
puts "Missing wordlist (try --help)"
exit 0
end
filename = ARGV.shift
hosts = ["google.com", "cnn.com", "reddit.com"]
def get_page (*hosts, page)
uri = URI.parse("http://#{hosts}/#{page}")
http = Net::HTTP.new(uri.host, uri.port)
request = Net::HTTP::Get.new(uri.request_uri)
res = http.request(request)
if res.code == "200"
puts "Valid page: #{page}"
elsif res.code == "403"
puts "Forbidden paged: #{page}"
else
end
end
File.open(filename, "r") do |f|
f.each_line do |line|
line.strip!
if line == ""
next
end
hosts.each do |host|
host.chomp('[')
get_page("#{host}", "#{line}")
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment