Skip to content

Commit 3f79b2f

Browse files
committed
Use :abort for scanner mixin
1 parent 99fe2a3 commit 3f79b2f

File tree

1 file changed

+6
-13
lines changed

1 file changed

+6
-13
lines changed

modules/auxiliary/scanner/http/tomcat_enum.rb

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -56,18 +56,12 @@ def target_url
5656

5757
def run_host(ip)
5858
@users_found = {}
59-
results = ""
6059

6160
each_user_pass { |user,pass|
62-
results = do_login(user)
63-
if results == "NetworkError"
64-
break
65-
end
61+
do_login(user)
6662
}
67-
68-
if results == "NetworkError"
69-
print_error("#{target_url} - UNREACHABLE")
70-
elsif(@users_found.empty?)
63+
64+
if(@users_found.empty?)
7165
print_status("#{target_url} - No users found.")
7266
else
7367
print_good("#{target_url} - Users found: #{@users_found.keys.sort.join(", ")}")
@@ -105,10 +99,9 @@ def do_login(user)
10599
return :abort
106100
end
107101

108-
rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout
109-
return "NetworkError"
110-
rescue ::Timeout::Error, ::Errno::EPIPE
111-
return "NetworkError"
102+
rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout, ::Timeout::Error, ::Errno::EPIPE
103+
print_error("#{target_url} - UNREACHABLE")
104+
return :abort
112105
end
113106
end
114107

0 commit comments

Comments
 (0)