Skip to content

Commit f3b426c

Browse files
committed
Fix usages of #empty? too
Fix usages of #empty? in ldap_esc_vulnerable_cert_finder too
1 parent f5046d0 commit f3b426c

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

modules/auxiliary/gather/ldap_esc_vulnerable_cert_finder.rb

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,6 @@ def query_ldap_server(raw_filter, attributes, base_prefix: nil)
140140
returned_entries = @ldap.search(base: full_base_dn, filter: filter, attributes: attributes, controls: controls)
141141
query_result_table = @ldap.get_operation_result.table
142142
validate_query_result!(query_result_table, filter)
143-
144-
return nil if returned_entries.empty?
145-
146143
returned_entries
147144
end
148145

@@ -184,8 +181,8 @@ def convert_sids_to_human_readable_name(sids_array)
184181
attributes = ['sAMAccountName', 'name']
185182
base_prefix = 'CN=Configuration'
186183
sid_entry = query_ldap_server(raw_filter, attributes, base_prefix: base_prefix) # First try with prefix to find entries that may be group specific.
187-
sid_entry = query_ldap_server(raw_filter, attributes) if sid_entry.blank? # Retry without prefix if blank.
188-
if sid_entry.blank?
184+
sid_entry = query_ldap_server(raw_filter, attributes) if sid_entry.empty? # Retry without prefix if blank.
185+
if sid_entry.empty?
189186
print_warning("Could not find any details on the LDAP server for SID #{sid}!")
190187
output << [sid, nil, nil] # Still want to print out the SID even if we couldn't get additional information.
191188
elsif sid_entry[0][:samaccountname][0]
@@ -350,7 +347,7 @@ def find_enrollable_vuln_certificate_templates
350347
attributes = ['cn', 'dnsHostname', 'ntsecuritydescriptor']
351348
base_prefix = 'CN=Enrollment Services,CN=Public Key Services,CN=Services,CN=Configuration'
352349
enrollment_ca_data = query_ldap_server(certificate_enrollment_raw_filter, attributes, base_prefix: base_prefix)
353-
next if enrollment_ca_data.blank?
350+
next if enrollment_ca_data.empty?
354351

355352
enrollment_ca_data.each do |ca_server|
356353
begin

0 commit comments

Comments
 (0)