From b2e3ce1f8a1acb02f411a086ae34f0e8df654251 Mon Sep 17 00:00:00 2001 From: jvazquez-r7 Date: Mon, 26 Oct 2015 16:40:29 -0500 Subject: [PATCH] Allow to finish when deletion fails --- modules/exploits/windows/smb/psexec.rb | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/modules/exploits/windows/smb/psexec.rb b/modules/exploits/windows/smb/psexec.rb index f99288beef..350f0d858a 100644 --- a/modules/exploits/windows/smb/psexec.rb +++ b/modules/exploits/windows/smb/psexec.rb @@ -231,10 +231,18 @@ class Metasploit3 < Msf::Exploit::Remote #This is not really useful but will prevent double \\ on the wire :) if datastore['SHARE'] =~ /.[\\\/]/ simple.connect("\\\\#{datastore['RHOST']}\\#{smbshare}") - simple.delete("\\#{fileprefix}\\#{filename}") + begin + simple.delete("\\#{fileprefix}\\#{filename}") + rescue XCEPT::ErrorCode => e + print_error("Delete of \\#{fileprefix}\\#{filename} failed: #{e.message}") + end else simple.connect("\\\\#{datastore['RHOST']}\\#{smbshare}") - simple.delete("\\#{filename}") + begin + simple.delete("\\#{filename}") + rescue XCEPT::ErrorCode => e + print_error("Delete of \\#{filename} failed: #{e.message}") + end end end end