Skip to content

Commit 64c2bf3

Browse files
committed
don't raise exception if file download fails
1 parent 284ef5b commit 64c2bf3

File tree

1 file changed

+2
-10
lines changed
  • lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi

1 file changed

+2
-10
lines changed

lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi/fs.rb

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -324,16 +324,8 @@ def cmd_edit(*args)
324324
meterp_temp.binmode
325325
temp_path = meterp_temp.path
326326

327-
begin
328-
# Download the remote file to the temporary file
329-
client.fs.file.download_file(temp_path, args[0])
330-
rescue RequestError => re
331-
# If the file doesn't exist, then it's okay. Otherwise, throw the
332-
# error.
333-
if re.result != 2
334-
raise $!
335-
end
336-
end
327+
# Try to download the file, but don't worry if it doesn't exist
328+
client.fs.file.download_file(temp_path, args[0]) rescue nil
337329

338330
# Spawn the editor (default to vi)
339331
editor = Rex::Compat.getenv('EDITOR') || 'vi'

0 commit comments

Comments
 (0)