Add begin-rescue blocks that prevent individual hosts from bailing out a threaded multi-host execution

bug/bundler_fix
Dylan Davis 2016-11-11 10:15:36 -07:00
parent e139a1ee8f
commit 69a4a327b8
1 changed files with 10 additions and 1 deletions

View File

@ -136,7 +136,11 @@ class MetasploitModule < Msf::Auxiliary
# check if our process is done using these files
def exclusive_access(*files)
begin
simple.connect("\\\\#{@ip}\\#{@smbshare}")
rescue
return false
end
files.each do |file|
begin
print_status("checking if the file is unlocked")
@ -154,7 +158,12 @@ class MetasploitModule < Msf::Auxiliary
# Removes files created during execution.
def cleanup_after(*files)
simple.connect("\\\\#{@ip}\\#{@smbshare}")
begin
simple.connect("\\\\#{@ip}\\#{@smbshare}")
rescue
print_error("Unable to connect for cleanup. Maybe you'll need to manually remove #{left.join(", ")} from the target.")
return
end
print_status("Executing cleanup...")
files.each do |file|
begin