forked from p15670423/monkey
Agent: Set self.exploit_result.error_message in PowerShellExploiter
This commit is contained in:
parent
f99053f3b4
commit
df572d84c0
|
@ -56,7 +56,9 @@ class PowerShellExploiter(HostExploiter):
|
|||
use_ssl = self._is_client_using_https()
|
||||
except PowerShellRemotingDisabledError as e:
|
||||
logging.info(e)
|
||||
# TODO: Set error message
|
||||
self.exploit_result.error_message = (
|
||||
"PowerShell Remoting appears to be disabled on the remote host"
|
||||
)
|
||||
return self.exploit_result
|
||||
|
||||
credentials = get_credentials(
|
||||
|
@ -71,7 +73,9 @@ class PowerShellExploiter(HostExploiter):
|
|||
|
||||
self._client = self._authenticate_via_brute_force(credentials, auth_options)
|
||||
if not self._client:
|
||||
# TODO: Set error message
|
||||
self.exploit_result.error_message = (
|
||||
"Unable to authenticate to the remote host using any of the available credentials"
|
||||
)
|
||||
return self.exploit_result
|
||||
|
||||
try:
|
||||
|
|
|
@ -59,6 +59,7 @@ def test_powershell_disabled(monkeypatch, powershell_exploiter, powershell_argum
|
|||
|
||||
exploit_result = powershell_exploiter.exploit_host(**powershell_arguments)
|
||||
assert not exploit_result.exploitation_success
|
||||
assert "disabled" in exploit_result.error_message
|
||||
|
||||
|
||||
def test_powershell_http(monkeypatch, powershell_exploiter, powershell_arguments):
|
||||
|
@ -98,6 +99,7 @@ def test_no_valid_credentials(monkeypatch, powershell_exploiter, powershell_argu
|
|||
|
||||
exploit_result = powershell_exploiter.exploit_host(**powershell_arguments)
|
||||
assert not exploit_result.exploitation_success
|
||||
assert "Unable to authenticate" in exploit_result.error_message
|
||||
|
||||
|
||||
def authenticate(mock_client):
|
||||
|
@ -130,6 +132,7 @@ def test_failed_copy(monkeypatch, powershell_exploiter, powershell_arguments):
|
|||
|
||||
exploit_result = powershell_exploiter.exploit_host(**powershell_arguments)
|
||||
assert not exploit_result.exploitation_success
|
||||
assert "copy" in exploit_result.error_message
|
||||
|
||||
|
||||
def test_failed_monkey_execution(monkeypatch, powershell_exploiter, powershell_arguments):
|
||||
|
@ -145,6 +148,7 @@ def test_failed_monkey_execution(monkeypatch, powershell_exploiter, powershell_a
|
|||
exploit_result = powershell_exploiter.exploit_host(**powershell_arguments)
|
||||
# assert exploit_result.exploitation_success is True
|
||||
assert exploit_result.propagation_success is False
|
||||
assert "execute" in exploit_result.error_message
|
||||
|
||||
|
||||
def test_login_attemps_correctly_reported(monkeypatch, powershell_exploiter, powershell_arguments):
|
||||
|
|
Loading…
Reference in New Issue