Advertisement
iAnonGuy

BannerGrab [Ruby]

May 30th, 2016
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 1.88 KB | None | 0 0
  1. require 'socket'
  2.  
  3. Gem.win_platform? ? (system "cls") : (system "clear")
  4. puts "
  5. ____                               _____           _    
  6. |  _ \\                             / ____|         | |    
  7. | |_) | __ _ _ __  _ __   ___ _ __| |  __ _ __ __ _| |__  
  8. |  _ < / _` | '_ \\| '_ \\ / _ \\ '__| | |_ | '__/ _` | '_ \\
  9. | |_) | (_| | | | | | | |  __/ |  | |__| | | | (_| | |_) |
  10. |____/ \\__,_|_| |_|_| |_|\\___|_|   \\_____|_|  \\__,_|_.__/ ~ by AnonGuy" # [ blog.lolwaleet.com ] -- [ an0nguy @ protonmail.ch ]
  11. print "\nURL -- > "
  12.  
  13. url       = gets.chomp.chomp('/').sub(/^https?\:\/\/(www.)?/, '')
  14. separator = '-----------------------------------------------------------------------'
  15. counter   = 0
  16.  
  17. puts separator
  18. begin
  19.     Socket.gethostbyname(url)
  20. rescue SocketError
  21.         abort("Error! -- Can't find #{url}!\n#{separator}")
  22. end
  23. sckt = TCPSocket.open(url, 80)
  24. sckt.puts "HEAD / HTTP/1.1"
  25. sckt.puts "Host: #{url}"
  26. sckt.puts "User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.0"
  27. sckt.puts "Connection: close\n\n"
  28. headers = sckt.recv(500).rstrip
  29. sckt.close
  30. puts headers
  31. puts separator
  32. array = {'Server' => '[!] Server header found!', 'X-Generator' => '[!] X-Generator header found!', 'X-Powered-By' => '[!] X-Powered-By header found!', 'zope3' => '[!] Zope framework in use!', 'CAKEPHP' => '[!] CakePHP framework in use!', 'kohanasession' => '[!] Kohana framework in use!', 'X-AspNet-Version' => '[!] ASP.NET framework in use!', 'laravel_session' => '[!] Laravel framework in use!', '__cfduid' => '[!] Site is behind CloudFlare!', 'ns_af' => '[!] Site is behind Citrix Netscaler WAF!', 'Joomla' => '[!] Site is using Joomla!', 'Drupal' => '[!] Site is using Drupal!', 'X-Pingback' => '[!] Site is running Wordpress!'}
  33. array.each_pair do |key, description|
  34.     if headers.include?(key)
  35.         counter += 1
  36.         puts "#{counter} -- #{description}"
  37.     end
  38. end
  39. print separator
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement