From 3f79b2fd3b399ebb2be187f9b4a4c2f42b0e5170 Mon Sep 17 00:00:00 2001 From: Nathan Einwechter Date: Mon, 25 Mar 2013 12:59:18 -0400 Subject: [PATCH] Use :abort for scanner mixin --- modules/auxiliary/scanner/http/tomcat_enum.rb | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/modules/auxiliary/scanner/http/tomcat_enum.rb b/modules/auxiliary/scanner/http/tomcat_enum.rb index 89af628a68..c650899cbd 100644 --- a/modules/auxiliary/scanner/http/tomcat_enum.rb +++ b/modules/auxiliary/scanner/http/tomcat_enum.rb @@ -56,18 +56,12 @@ class Metasploit3 < Msf::Auxiliary def run_host(ip) @users_found = {} - results = "" each_user_pass { |user,pass| - results = do_login(user) - if results == "NetworkError" - break - end + do_login(user) } - - if results == "NetworkError" - print_error("#{target_url} - UNREACHABLE") - elsif(@users_found.empty?) + + if(@users_found.empty?) print_status("#{target_url} - No users found.") else print_good("#{target_url} - Users found: #{@users_found.keys.sort.join(", ")}") @@ -105,10 +99,9 @@ class Metasploit3 < Msf::Auxiliary return :abort end - rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout - return "NetworkError" - rescue ::Timeout::Error, ::Errno::EPIPE - return "NetworkError" + rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout, ::Timeout::Error, ::Errno::EPIPE + print_error("#{target_url} - UNREACHABLE") + return :abort end end