Tests: Fix broken PowerShellExploiter tests

This commit is contained in:
Mike Salvatore 2022-03-23 14:32:08 -04:00
parent d3fc833813
commit 99b8321271
1 changed files with 5 additions and 2 deletions

View File

@ -26,6 +26,9 @@ class AuthenticationErrorForTests(Exception):
mock_agent_repository = MagicMock()
mock_agent_repository.get_agent_binary.return_value = BytesIO(b"BINARY_EXECUTABLE")
victim_host = VictimHost("127.0.0.1")
victim_host.os["type"] = "windows"
@pytest.fixture
def powershell_arguments():
@ -39,7 +42,7 @@ def powershell_arguments():
},
}
arguments = {
"host": VictimHost("127.0.0.1"),
"host": victim_host,
"options": options,
"current_depth": 2,
"telemetry_messenger": MagicMock(),
@ -141,7 +144,7 @@ def test_successful_copy(monkeypatch, powershell_exploiter, powershell_arguments
exploit_result = powershell_exploiter.exploit_host(**powershell_arguments)
assert DROPPER_TARGET_PATH_64 in mock_client.return_value.copy_file.call_args[0][1]
assert DROPPER_TARGET_PATH_64 in str(mock_client.return_value.copy_file.call_args[0][1])
assert exploit_result.exploitation_success