Skip to content

Commit a6229ae

Browse files
committed
Rescue RequestError when downloading file
1 parent f2a71a4 commit a6229ae

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

modules/post/windows/gather/enum_muicache.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,13 @@ def process_hive(sys_path, user, muicache, hive_file)
149149
print_status("Downloading #{user}'s NTUSER.DAT/USRCLASS.DAT file..")
150150
local_hive_copy = Rex::Quickfile.new("jtrtmp")
151151
local_hive_copy.close
152-
session.fs.file.download_file(local_hive_copy.path, hive_path)
152+
begin
153+
session.fs.file.download_file(local_hive_copy.path, hive_path)
154+
rescue ::Rex::Post::Meterpreter::RequestError
155+
print_error("Unable to download NTUSER.DAT/USRCLASS.DAT file")
156+
local_hive_copy.unlink rescue nil
157+
return nil
158+
end
153159
results = hive_parser(local_hive_copy.path, muicache, user)
154160
local_hive_copy.unlink rescue nil # Windows often complains about unlinking tempfiles
155161

0 commit comments

Comments
 (0)