Skip to content

Commit b2e3ce1

Browse files
committed
Allow to finish when deletion fails
1 parent f4abc16 commit b2e3ce1

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

modules/exploits/windows/smb/psexec.rb

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,10 +231,18 @@ def exploit
231231
#This is not really useful but will prevent double \\ on the wire :)
232232
if datastore['SHARE'] =~ /.[\\\/]/
233233
simple.connect("\\\\#{datastore['RHOST']}\\#{smbshare}")
234-
simple.delete("\\#{fileprefix}\\#{filename}")
234+
begin
235+
simple.delete("\\#{fileprefix}\\#{filename}")
236+
rescue XCEPT::ErrorCode => e
237+
print_error("Delete of \\#{fileprefix}\\#{filename} failed: #{e.message}")
238+
end
235239
else
236240
simple.connect("\\\\#{datastore['RHOST']}\\#{smbshare}")
237-
simple.delete("\\#{filename}")
241+
begin
242+
simple.delete("\\#{filename}")
243+
rescue XCEPT::ErrorCode => e
244+
print_error("Delete of \\#{filename} failed: #{e.message}")
245+
end
238246
end
239247
end
240248
end

0 commit comments

Comments
 (0)