Use fail_with
parent
3eab7107b8
commit
8590720890
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue