Fixed cleanup method to report an Error on command.rb

unstable
Royce Davis 2012-11-19 13:59:58 -06:00
parent f9b4971fc3
commit 7fa8717860
1 changed files with 16 additions and 9 deletions

View File

@ -119,9 +119,11 @@ class Metasploit3 < Msf::Auxiliary
simple.connect(smbshare) simple.connect(smbshare)
print_status("Executing cleanup on host: #{ip}") print_status("Executing cleanup on host: #{ip}")
psexec(smbshare, cleanup) psexec(smbshare, cleanup)
#if !check_cleanup(smbshare, ip, text) if !check_cleanup(smbshare, ip, text)
# print_error("#{ip} - Unable to cleanup. Need to manually remove #{text} and #{bat} from the target.") print_error("#{ip} - Unable to cleanup. Need to manually remove #{text} and #{bat} from the target.")
#end else
print_status("#{ip} - Cleanup was successful")
end
rescue StandardError => cleanuperror rescue StandardError => cleanuperror
print_error("Unable to processes cleanup commands: #{cleanuperror}") print_error("Unable to processes cleanup commands: #{cleanuperror}")
return cleanuperror return cleanuperror
@ -132,13 +134,18 @@ class Metasploit3 < Msf::Auxiliary
def check_cleanup(smbshare, ip, text) def check_cleanup(smbshare, ip, text)
simple.connect("\\\\#{ip}\\#{smbshare}") simple.connect("\\\\#{ip}\\#{smbshare}")
if checktext = simple.open(text, 'ro') begin
check = false if checktext = simple.open(text, 'ro')
else check = false
check = true else
check = true
end
simple.disconnect("\\\\#{ip}\\#{smbshare}")
return check
rescue StandardError => check_error
simple.disconnect("\\\\#{ip}\\#{smbshare}")
return true
end end
simple.disconnect("\\\\#{ip}\\#{smbshare}")
return check
end end