RAILS 30
Cloudflare Resolver.rb Guest on 4th September 2020 01:15:31 PM
  1. #HatCloud build in Ruby. It makes bypass in CloudFlare for discover real IP. This can be useful if you need test your server and #website. Testing your protection against Ddos (Denial of Service) or Dos. CloudFlare is services and distributed domain name server #services, sitting between the visitor and the Cloudflare user's hosting provider, acting as a reverse proxy for websites. Your network #protects, speeds up and improves availability for a website or the mobile application with a DNS change.
  2. #Version: 1.0
  3. #Use: ruby hatcloud.rb -h or --help
  4. #ruby hatcloud.rb -b your site
  5. #or
  6. #ruby hatcloud.rb --byp your site
  7.  
  8.  
  9. #!/usr/bin/env ruby
  10. # encoding: UTF-8
  11. require 'net/http'
  12. require 'open-uri'
  13. require 'json'
  14. require 'socket'
  15. require 'optparse'
  16.  
  17. def banner()
  18. red = "\033[01;31m"
  19. green = "\033[01;32m"
  20.  
  21.  
  22. puts "\n"
  23. puts"██╗  ██╗ █████╗ ████████╗     ██████╗██╗      ██████╗ ██╗   ██╗██████╗ "
  24. puts"██║  ██║██╔══██╗╚══██╔══╝    ██╔════╝██║     ██╔═══██╗██║   ██║██╔══██╗"
  25. puts"███████║███████║   ██║       ██║     ██║     ██║   ██║██║   ██║██║  ██║"
  26. puts"██╔══██║██╔══██║   ██║       ██║     ██║     ██║   ██║██║   ██║██║  ██║"
  27. puts"██║  ██║██║  ██║   ██║       ╚██████╗███████╗╚██████╔╝╚██████╔╝██████╔╝"
  28. puts"╚═╝  ╚═╝╚═╝  ╚═╝   ╚═╝        ╚═════╝╚══════╝ ╚═════╝  ╚═════╝ ╚═════╝   "
  29. puts "\n"
  30.  
  31.  
  32.  
  33. puts "#{red}Tool for identifying real IP of CloudFlare protected website."
  34. puts "fb.com/hatbashbr/"
  35. puts "github.com/hatbashbr/"
  36.  
  37. puts "\n"
  38. end
  39.  
  40. options = {:bypass => nil, :massbypass => nil}
  41. parser = OptionParser.new do|opts|
  42.  
  43.     opts.banner = "Example: ruby hatcloud.rb -b <your target> or ruby hatcloud.rb --byp <your target>"
  44.     opts.on('-b ','--byp ', 'Discover real IP (bypass CloudFlare)', String)do |bypass|
  45.     options[:bypass]=bypass;
  46.     end
  47.  
  48.     opts.on('-o', '--out', 'Next release.', String) do |massbypass|
  49.         options[:massbypass]=massbypass
  50.  
  51.     end
  52.  
  53.     opts.on('-h', '--help', 'Help') do
  54.         banner()
  55.         puts opts
  56.         puts "Example: ruby hatcloud.rb -b discordapp.com or ruby hatcloud.rb --byp discordapp.com"
  57.         exit
  58.     end
  59. end
  60.  
  61. parser.parse!
  62.  
  63.  
  64. banner()
  65.  
  66. if options[:bypass].nil?
  67.     puts "Insert URL -b or --byp"
  68. else
  69.         option = options[:bypass]
  70.         payload = URI ("http://www.crimeflare.org/cgi-bin/cfsearch.cgi")
  71.         request = Net::HTTP.post_form(payload, 'cfS' => options[:bypass])
  72.  
  73.         response =  request.body
  74.         nscheck = /No working nameservers are registered/.match(response)
  75.         if( !nscheck.nil? )
  76.                 puts "[-] No valid address - are you sure this is a CloudFlare protected domain?\n"
  77.                 exit
  78.         end
  79.         regex = /(\d*\.\d*\.\d*\.\d*)/.match(response)
  80.         if( regex.nil? || regex == "" )
  81.                 puts "[-] No valid address - are you sure this is a CloudFlare protected domain?\n"
  82.                 puts "[-] Alternately, maybe crimeflare.org is down? Try it by hand.\n"
  83.                 exit
  84.         end
  85.         ip_real = IPSocket.getaddress (options[:bypass])
  86.  
  87.         puts "[+] Site analysis: #{option} "
  88.         puts "[+] CloudFlare IP is #{ip_real} "
  89.         puts "[+] Real IP is #{regex}"
  90.         target = "http://ipinfo.io/#{regex}/json"
  91.         url = URI(target).read
  92.         json = JSON.parse(url)
  93.         puts "[+] Hostname: " + json['hostname']
  94.         puts "[+] City: "  + json['city']
  95.         puts "[+] Region: " + json['country']
  96.         puts "[+] Location: " + json['loc']
  97.         puts "[+] Organization: " + json['org']
  98.  
  99. end

Paste is for source code and general debugging text.

Login or Register to edit, delete and keep track of your pastes and more.

Raw Paste

Login or Register to edit or fork this paste. It's free.