Advertisement
KhaosBringer

Cloudflare Resolver.rb

Nov 26th, 2018
1,464
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 3.85 KB | None | 0 0
  1.  
  2. #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.
  3. #Version: 1.0
  4. #Use: ruby hatcloud.rb -h or --help
  5. #ruby hatcloud.rb -b your site
  6. #or
  7. #ruby hatcloud.rb --byp your site
  8.  
  9.  
  10. #!/usr/bin/env ruby
  11. # encoding: UTF-8
  12. require 'net/http'
  13. require 'open-uri'
  14. require 'json'
  15. require 'socket'
  16. require 'optparse'
  17.  
  18. def banner()
  19. red = "\033[01;31m"
  20. green = "\033[01;32m"
  21.  
  22.  
  23. puts "\n"
  24. puts"██╗  ██╗ █████╗ ████████╗     ██████╗██╗      ██████╗ ██╗   ██╗██████╗ "
  25. puts"██║  ██║██╔══██╗╚══██╔══╝    ██╔════╝██║     ██╔═══██╗██║   ██║██╔══██╗"
  26. puts"███████║███████║   ██║       ██║     ██║     ██║   ██║██║   ██║██║  ██║"
  27. puts"██╔══██║██╔══██║   ██║       ██║     ██║     ██║   ██║██║   ██║██║  ██║"
  28. puts"██║  ██║██║  ██║   ██║       ╚██████╗███████╗╚██████╔╝╚██████╔╝██████╔╝"
  29. puts"╚═╝  ╚═╝╚═╝  ╚═╝   ╚═╝        ╚═════╝╚══════╝ ╚═════╝  ╚═════╝ ╚═════╝ "
  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
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement