Merge pull request #11 from Winterspite/master

Fixed #10 plus a few readability fixes
master
Mateus Lino 2017-09-29 12:01:02 -03:00 committed by GitHub
commit 1cf9421e07
1 changed files with 43 additions and 33 deletions

View File

@ -1,4 +1,4 @@
#!/usr/local/bin/ruby -w #!/usr/bin/env ruby
# encoding: UTF-8 # encoding: UTF-8
require 'net/http' require 'net/http'
require 'open-uri' require 'open-uri'
@ -33,7 +33,7 @@ end
options = {:bypass => nil, :massbypass => nil} options = {:bypass => nil, :massbypass => nil}
parser = OptionParser.new do|opts| parser = OptionParser.new do|opts|
opts.banner = "Example: ruby cloudhat.rb -b <your target> or ruby cloudhat.rb --byp <your target>" opts.banner = "Example: ruby hatcloud.rb -b <your target> or ruby hatcloud.rb --byp <your target>"
opts.on('-b ','--byp ', 'Discover real IP (bypass CloudFlare)', String)do |bypass| opts.on('-b ','--byp ', 'Discover real IP (bypass CloudFlare)', String)do |bypass|
options[:bypass]=bypass; options[:bypass]=bypass;
end end
@ -46,7 +46,7 @@ parser = OptionParser.new do|opts|
opts.on('-h', '--help', 'Help') do opts.on('-h', '--help', 'Help') do
banner() banner()
puts opts puts opts
puts "Example: ruby cloudhat.rb -b discordapp.com or ruby cloudhat.rb --byp discordapp.com" puts "Example: ruby hatcloud.rb -b discordapp.com or ruby hatcloud.rb --byp discordapp.com"
exit exit
end end
end end
@ -59,12 +59,22 @@ banner()
if options[:bypass].nil? if options[:bypass].nil?
puts "Insert URL -b or --byp" puts "Insert URL -b or --byp"
else else
option = options[:bypass] option = options[:bypass]
payload = URI ("http://www.crimeflare.org/cgi-bin/cfsearch.cgi") payload = URI ("http://www.crimeflare.org/cgi-bin/cfsearch.cgi")
request = Net::HTTP.post_form(payload, 'cfS' => options[:bypass]) request = Net::HTTP.post_form(payload, 'cfS' => options[:bypass])
response = request.body response = request.body
regex = /(\d*\.\d*\.\d*\.\d*)/.match(response) nscheck = /No working nameservers are registered/.match(response)
if( !nscheck.nil? )
puts "[-] No valid address - are you sure this is a CloudFlare protected domain?\n"
exit
end
regex = /(\d*\.\d*\.\d*\.\d*)/.match(response)
if( regex.nil? || regex == "" )
puts "[-] No valid address - are you sure this is a CloudFlare protected domain?\n"
puts "[-] Alternately, maybe crimeflare.org is down? Try it by hand.\n"
exit
end
ip_real = IPSocket.getaddress (options[:bypass]) ip_real = IPSocket.getaddress (options[:bypass])
puts "[+] Site analysis: #{option} " puts "[+] Site analysis: #{option} "