0xsauby / yasuo

A ruby script that scans for vulnerable & exploitable 3rd-party web applications on a network
GNU General Public License v3.0
569 stars 139 forks source link

Error and more #17

Closed KINGSABRI closed 9 years ago

KINGSABRI commented 9 years ago

Hi, when running the script against some target it rises the the following error

`block (2 levels) in find_vulnerable_applications': undefined method `code' for nil:NilClass (NoMethodError)
from ./yasuo.rb:282:in `each'
from ./yasuo.rb:282:in `each_with_index'
from ./yasuo.rb:282:in `block in find_vulnerable_applications'
from ./yasuo.rb:276:in `each_key'
from ./yasuo.rb:276:in `find_vulnerable_applications'
from ./yasuo.rb:192:in `block (2 levels) in process_nmap_scan'

the error is the follwowing line

https://github.com/0xsauby/yasuo/blob/master/yasuo.rb#L291

That's because resp getting nil value

you can place the following before it to debug

        if resp.nil?
          puts "[+] Oooops!".red.bold
          pp attack_url
          pp resp
          pp resp.body
          puts "Exiting!!!!\n\n\n".red
          exit 0
        end

another thing ,, you're using colorize gem which is great gem but it lot more than what you need

you can just place the following at the beginning and add what you need

class String
  def red; colorize(self, "\e[1m\e[31m"); end
  def green; colorize(self, "\e[1m\e[32m"); end
  def dark_green; colorize(self, "\e[32m"); end
  def yellow; colorize(self, "\e[1m\e[33m"); end
  def blue; colorize(self, "\e[1m\e[34m"); end
  def dark_blue; colorize(self, "\e[34m"); end
  def purple; colorize(self, "\e[35m"); end
  def dark_purple; colorize(self, "\e[1;35m"); end
  def cyan; colorize(self, "\e[1;36m"); end
  def dark_cyan; colorize(self, "\e[36m"); end
  def pure; colorize(self, "\e[1m\e[35m"); end
  def bold; colorize(self, "\e[1m"); end
  def colorize(text, color_code)  "#{color_code}#{text}\e[0m" end
end

use it as colorize gem

puts "RubyFu".red
puts "RubyFu".green
puts "RubyFu".yellow.bold

I was trying to contribute more effectively but it got hit by punch of tasks :D more usefull things in RubyFu book (http://kingsabri.gitbooks.io/rubyfu)

HTH Regards and respect

0xsauby commented 9 years ago

I thought I fixed that resp returning nil bug. Apparently not. Thanks for the recommendation regarding colorize gem. Much better. I'll implement all this today, hopefully. Thanks again.

enderax commented 9 years ago

Hi, I got same error:


I, [2015-06-16T11:42:30.912541 #111765]  INFO -- : Discovered open port: 172.16.15.248:8080
I, [2015-06-16T11:42:30.975298 #111765]  INFO -- : <<>>
Yasuo found an unauthenticated instance of Apache Tomcat at http://172.16.15.248:8080/manager.
yasuo.rb:291:in `block (2 levels) in find_vulnerable_applications': undefined method `code' for nil:NilClass (NoMethodError)
    from yasuo.rb:282:in `each'
    from yasuo.rb:282:in `each_with_index'
    from yasuo.rb:282:in `block in find_vulnerable_applications'
    from yasuo.rb:276:in `each_key'
    from yasuo.rb:276:in `find_vulnerable_applications'
    from yasuo.rb:192:in `block (2 levels) in process_nmap_scan'

And there is an false positive in it. The running service is actually Asterisk/1.4.19.

0xsauby commented 9 years ago

I have fixed this issue. Please test and let me know if you are still having issues. There may be some false positives every now and then if the application signatures are same for 2 or more apps.