Land #4389, Meatballs1's fix for enum_ad_* post module regressions

Fixes #4387 by adjusting for the new return type from ADSI queries.
bug/bundler_fix
Brent Cook 2014-12-15 10:45:12 -06:00
commit c24fdb81b5
No known key found for this signature in database
GPG Key ID: 663AF51BD5E4D8D5
5 changed files with 10 additions and 10 deletions

View File

@ -149,7 +149,7 @@ module LDAP
query_result = query_ldap(session_handle, "", 0, "(objectClass=computer)", ["defaultNamingContext"]) query_result = query_ldap(session_handle, "", 0, "(objectClass=computer)", ["defaultNamingContext"])
first_entry_fields = query_result[:results].first first_entry_fields = query_result[:results].first
# Value from First Attribute of First Entry # Value from First Attribute of First Entry
default_naming_context = first_entry_fields.first default_naming_context = first_entry_fields.first[:value]
vprint_status("Default naming context #{default_naming_context}") vprint_status("Default naming context #{default_naming_context}")
return default_naming_context return default_naming_context
end end
@ -231,7 +231,7 @@ module LDAP
values_result = values.join(',') if values values_result = values.join(',') if values
vprint_status("Values #{values}") vprint_status("Values #{values}")
field_results << values_result field_results << {:type => 'unknown', :value => values_result}
end end
entry_results << field_results entry_results << field_results

View File

@ -81,7 +81,7 @@ class Metasploit3 < Msf::Post
report = {} report = {}
0.upto(fields.length-1) do |i| 0.upto(fields.length-1) do |i|
field = result[i] || "" field = result[i][:value] || ""
# Only perform these actions if the database is connected and we want # Only perform these actions if the database is connected and we want
# to store in the DB. # to store in the DB.
@ -92,7 +92,7 @@ class Metasploit3 < Msf::Post
report[:name] = dns report[:name] = dns
hostnames << dns hostnames << dns
when 'operatingSystem' when 'operatingSystem'
report[:os_name] = field report[:os_name] = field.gsub("\xAE",'')
when 'distinguishedName' when 'distinguishedName'
if field =~ /Domain Controllers/i if field =~ /Domain Controllers/i
# TODO: Find another way to mark a host as being a domain controller # TODO: Find another way to mark a host as being a domain controller

View File

@ -100,7 +100,7 @@ class Metasploit3 < Msf::Post
row = [] row = []
0.upto(fields.length-1) do |i| 0.upto(fields.length-1) do |i|
field = (result[i].nil? ? "" : result[i]) field = (result[i][:value].nil? ? "" : result[i][:value])
if fields[i] == 'servicePrincipalName' if fields[i] == 'servicePrincipalName'
break if field.blank? break if field.blank?

View File

@ -26,7 +26,6 @@ class Metasploit3 < Msf::Post
'company', 'company',
'streetAddress', 'streetAddress',
'sAMAccountName', 'sAMAccountName',
'userAccountControl',
'comment', 'comment',
'description' 'description'
] ]
@ -37,7 +36,7 @@ class Metasploit3 < Msf::Post
'Description' => %q{ 'Description' => %q{
This module will gather information from the default Active Domain (AD) directory This module will gather information from the default Active Domain (AD) directory
and use these words to seed a wordlist. By default it enumerates user accounts to and use these words to seed a wordlist. By default it enumerates user accounts to
build the wordlist build the wordlist.
}, },
'License' => MSF_LICENSE, 'License' => MSF_LICENSE,
'Author' => ['Thomas Ring'], 'Author' => ['Thomas Ring'],
@ -69,7 +68,7 @@ class Metasploit3 < Msf::Post
@words_dict = {} @words_dict = {}
q[:results].each do |result| q[:results].each do |result|
result.each do |field| result.each do |field|
search_words(field) search_words(field[:value])
end # result.each end # result.each
end # q.each end # q.each

View File

@ -65,10 +65,11 @@ class Metasploit3 < Msf::Post
report = {} report = {}
result.each do |field| result.each do |field|
if field.nil? if field[:value].nil?
row << "" row << ""
else else
row << field row << field[:value]
end end
end end