Skip to content

Commit 8590720

Browse files
committed
Use fail_with
1 parent 3eab710 commit 8590720

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

modules/exploits/windows/smb/psexec_psh.rb

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,19 +84,18 @@ def exploit
8484
begin
8585
smb_login
8686
rescue StandardError => autherror
87-
print_error("#{peer} - Unable to authenticate with given credentials: #{autherror}")
88-
return
87+
disconnect
88+
fail_with(Exploit::Failure::NoAccess, "#{peer} - Unable to authenticate with given credentials: #{autherror}")
8989
end
9090
# Execute the powershell command
9191
begin
9292
print_status("#{peer} - Executing the payload...")
9393
vprint_good(command)
9494
return psexec(command)
9595
rescue StandardError => exec_command_error
96-
print_error("#{peer} - Unable to execute specified command: #{exec_command_error}")
97-
return false
96+
disconnect
97+
fail_with(Exploit::Failure::Unknown, "#{peer} - Unable to execute specified command: #{exec_command_error}")
9898
end
99-
disconnect
10099
end
101100
end
102101

0 commit comments

Comments
 (0)