Skip to content

Commit 95b71de

Browse files
committed
Try to fix crash while file_remote_digest
1 parent cbbd7bf commit 95b71de

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

modules/post/windows/gather/enum_muicache.rb

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,12 @@ def enumerate_muicache(muicache_reg_keys, sys_users, sys_paths, muicache, hive_f
9696
# that the user is most likely not logged in and we'll need to
9797
# download and process users hive locally.
9898
print_error("User #{user}: Can't access registry (maybe the user is not logged in atm?). Trying NTUSER.DAT/USRCLASS.DAT..")
99-
results = process_hive(sys_path, user, local_hive_copy, muicache, hive_file) || []
99+
result = process_hive(sys_path, user, local_hive_copy, muicache, hive_file)
100+
unless result.nil?
101+
result.each { |r|
102+
results << r unless r.nil?
103+
}
104+
end
100105
else
101106
# If the registry_enumvals returns us content we'll know that we
102107
# can access the registry directly and thus continue to process
@@ -160,7 +165,12 @@ def hive_download_status(local_hive_copy, hive_path)
160165
hive_status = false
161166

162167
3.times do
163-
remote_hive_hash_raw = file_remote_digestmd5(hive_path)
168+
begin
169+
remote_hive_hash_raw = file_remote_digestmd5(hive_path)
170+
rescue EOFError, ::Rex::Post::Meterpreter::RequestError
171+
next
172+
end
173+
164174
if remote_hive_hash_raw.blank?
165175
next
166176
end

0 commit comments

Comments
 (0)