Skip to content

Commit aa60b4e

Browse files
committed
Switch back to using fail_with now that the issue is fixed
1 parent f8bf996 commit aa60b4e

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

modules/auxiliary/gather/ldap_hashdump.rb

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def run_host(ip)
8686

8787
entries_returned = 0
8888

89-
print_status("#{peer} Connecting ...")
89+
print_status("#{peer} Connecting...")
9090
ldap_new do |ldap|
9191
if ldap.get_operation_result.code == 0
9292
vprint_status("#{peer} LDAP connection established")
@@ -107,9 +107,7 @@ def run_host(ip)
107107
naming_contexts = get_naming_contexts(ldap)
108108
end
109109
rescue Timeout::Error
110-
print_error("#{peer} Host timeout reached")
111-
# fail_with(Failure::TimeoutExpired, 'The timeout expired while reading naming contects')
112-
return
110+
fail_with(Failure::TimeoutExpired, 'The timeout expired while reading naming contexts')
113111
ensure
114112
unless ldap.get_operation_result.code == 0
115113
print_ldap_error(ldap)
@@ -151,15 +149,12 @@ def run_host(ip)
151149

152150
# Safe if server did not returned anything
153151
unless (entries_returned > 0)
154-
print_error("#{peer} Server did not return any data, seems to be safe")
155-
# fail_with(Failure::NotVulnerable, 'Server does not return any data.')
152+
fail_with(Failure::NotVulnerable, 'Server did not return any data, seems to be safe')
156153
end
157154
rescue Timeout::Error
158-
print_error("#{peer} Host timeout reached")
159-
# fail_with(Failure::TimeoutExpired, 'The timeout expired while searching directory')
155+
fail_with(Failure::TimeoutExpired, 'The timeout expired while searching directory')
160156
rescue Net::LDAP::PDU::Error, Net::BER::BerError, Net::LDAP::Error, NoMethodError => e
161-
print_error("#{peer} #{e.class}: #{e.message}")
162-
# fail_with(Failure::UnexpectedReply, "Exception occured: #{e.class}: #{e.message}")
157+
fail_with(Failure::UnexpectedReply, "Exception occurred: #{e.class}: #{e.message}")
163158
end
164159

165160
def ldap_search(ldap, base_dn, args)

0 commit comments

Comments
 (0)