diff --git a/modules/exploits/windows/smb/psexec_psh.rb b/modules/exploits/windows/smb/psexec_psh.rb index 7ff74eb59d..b11da48106 100644 --- a/modules/exploits/windows/smb/psexec_psh.rb +++ b/modules/exploits/windows/smb/psexec_psh.rb @@ -84,8 +84,8 @@ class Metasploit3 < Msf::Exploit::Remote begin smb_login rescue StandardError => autherror - print_error("#{peer} - Unable to authenticate with given credentials: #{autherror}") - return + disconnect + fail_with(Exploit::Failure::NoAccess, "#{peer} - Unable to authenticate with given credentials: #{autherror}") end # Execute the powershell command begin @@ -93,10 +93,9 @@ class Metasploit3 < Msf::Exploit::Remote vprint_good(command) return psexec(command) rescue StandardError => exec_command_error - print_error("#{peer} - Unable to execute specified command: #{exec_command_error}") - return false + disconnect + fail_with(Exploit::Failure::Unknown, "#{peer} - Unable to execute specified command: #{exec_command_error}") end - disconnect end end