forked from p15670423/monkey
UT: Fix Powershell unit tests to accept list of servers
This commit is contained in:
parent
42de7140f3
commit
e6b0e43580
|
@ -6,7 +6,6 @@ import pytest
|
|||
|
||||
from infection_monkey.exploit import powershell
|
||||
from infection_monkey.exploit.tools.helpers import AGENT_BINARY_PATH_WIN64
|
||||
from infection_monkey.model.host import VictimHost
|
||||
|
||||
# Use the path_win32api_get_user_name fixture for all tests in this module
|
||||
pytestmark = pytest.mark.usefixtures("patch_win32api_get_user_name")
|
||||
|
@ -16,6 +15,8 @@ PASSWORD_LIST = ["pass1", "pass2"]
|
|||
LM_HASH_LIST = ["bogo_lm_1"]
|
||||
NT_HASH_LIST = ["bogo_nt_1", "bogo_nt_2"]
|
||||
|
||||
bogus_servers = ["1.1.1.1:5000", "2.2.2.2:5007"]
|
||||
|
||||
|
||||
mock_agent_binary_repository = MagicMock()
|
||||
mock_agent_binary_repository.get_agent_binary.return_value = BytesIO(b"BINARY_EXECUTABLE")
|
||||
|
@ -33,6 +34,7 @@ def powershell_arguments(http_and_https_both_enabled_host):
|
|||
}
|
||||
arguments = {
|
||||
"host": http_and_https_both_enabled_host,
|
||||
"servers": bogus_servers,
|
||||
"options": options,
|
||||
"current_depth": 2,
|
||||
"telemetry_messenger": MagicMock(),
|
||||
|
@ -179,11 +181,10 @@ def test_login_attempts_correctly_reported(monkeypatch, powershell_exploiter, po
|
|||
|
||||
|
||||
def test_build_monkey_execution_command():
|
||||
host = VictimHost("127.0.0.1")
|
||||
depth = 2
|
||||
executable_path = "/tmp/test-monkey"
|
||||
|
||||
cmd = powershell.build_monkey_execution_command(host, depth, executable_path)
|
||||
cmd = powershell.build_monkey_execution_command(bogus_servers, depth, executable_path)
|
||||
|
||||
assert f"-d {depth}" in cmd
|
||||
assert executable_path in cmd
|
||||
|
|
Loading…
Reference in New Issue