Guest User

Untitled

a guest
Oct 10th, 2017
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. require 'rexml/document'
  2. require 'net/http'
  3. require 'uri'
  4. require 'getoptlong'
  5. require 'fileutils'
  6. require 'optparse'
  7. require 'csv'
  8.  
  9. if ARGV.length != 1
  10. puts "Missing wordlist (try --help)"
  11. exit 0
  12. end
  13. filename = ARGV.shift
  14.  
  15. hosts = ["google.com", "cnn.com", "reddit.com"]
  16.  
  17. def get_page (*hosts, page)
  18. uri = URI.parse("http://#{hosts}/#{page}")
  19. http = Net::HTTP.new(uri.host, uri.port)
  20. request = Net::HTTP::Get.new(uri.request_uri)
  21. res = http.request(request)
  22. if res.code == "200"
  23. puts "Valid page: #{page}"
  24. elsif res.code == "403"
  25. puts "Forbidden paged: #{page}"
  26. else
  27. end
  28. end
  29.  
  30. File.open(filename, "r") do |f|
  31. f.each_line do |line|
  32. line.strip!
  33. if line == ""
  34. next
  35. end
  36. hosts.each do |host|
  37. host.chomp('[')
  38. get_page("#{host}", "#{line}")
  39. end
  40. end
  41. end
Advertisement
Add Comment
Please, Sign In to add comment