From 3af38d7841d98b1d54ebf5d81de930beb087c2f7 Mon Sep 17 00:00:00 2001 From: Ilija Lazoroski Date: Tue, 20 Sep 2022 18:06:12 +0200 Subject: [PATCH] BB: Fix some minor configuration issue in CredentialsReuse --- envs/monkey_zoo/blackbox/test_blackbox.py | 4 ++-- .../blackbox/test_configurations/__init__.py | 2 +- ...euse_ssh_key.py => credentials_reuse_ssh_key.py} | 13 ++++++++++--- 3 files changed, 13 insertions(+), 6 deletions(-) rename envs/monkey_zoo/blackbox/test_configurations/{credential_reuse_ssh_key.py => credentials_reuse_ssh_key.py} (81%) diff --git a/envs/monkey_zoo/blackbox/test_blackbox.py b/envs/monkey_zoo/blackbox/test_blackbox.py index 01c07b480..f140733ec 100644 --- a/envs/monkey_zoo/blackbox/test_blackbox.py +++ b/envs/monkey_zoo/blackbox/test_blackbox.py @@ -10,7 +10,7 @@ from envs.monkey_zoo.blackbox.island_client.monkey_island_client import MonkeyIs from envs.monkey_zoo.blackbox.island_client.test_configuration_parser import get_target_ips from envs.monkey_zoo.blackbox.log_handlers.test_logs_handler import TestLogsHandler from envs.monkey_zoo.blackbox.test_configurations import ( - credential_reuse_ssh_key_test_configuration, + credentials_reuse_ssh_key_test_configuration, depth_1_a_test_configuration, depth_2_a_test_configuration, depth_3_a_test_configuration, @@ -166,7 +166,7 @@ class TestMonkeyBlackbox: def test_credentials_reuse_ssh_key(self, island_client): TestMonkeyBlackbox.run_exploitation_test( - island_client, credential_reuse_ssh_key_test_configuration, "Credentials_Reuse_SSH_Key" + island_client, credentials_reuse_ssh_key_test_configuration, "Credentials_Reuse_SSH_Key" ) # Not grouped because conflicts with SMB. diff --git a/envs/monkey_zoo/blackbox/test_configurations/__init__.py b/envs/monkey_zoo/blackbox/test_configurations/__init__.py index 8355afdf3..ba0beec74 100644 --- a/envs/monkey_zoo/blackbox/test_configurations/__init__.py +++ b/envs/monkey_zoo/blackbox/test_configurations/__init__.py @@ -7,4 +7,4 @@ from .powershell_credentials_reuse import powershell_credentials_reuse_test_conf from .smb_pth import smb_pth_test_configuration from .wmi_mimikatz import wmi_mimikatz_test_configuration from .zerologon import zerologon_test_configuration -from .credential_reuse_ssh_key import credential_reuse_ssh_key_test_configuration +from .credentials_reuse_ssh_key import credentials_reuse_ssh_key_test_configuration diff --git a/envs/monkey_zoo/blackbox/test_configurations/credential_reuse_ssh_key.py b/envs/monkey_zoo/blackbox/test_configurations/credentials_reuse_ssh_key.py similarity index 81% rename from envs/monkey_zoo/blackbox/test_configurations/credential_reuse_ssh_key.py rename to envs/monkey_zoo/blackbox/test_configurations/credentials_reuse_ssh_key.py index 76c1709ed..e383e0124 100644 --- a/envs/monkey_zoo/blackbox/test_configurations/credential_reuse_ssh_key.py +++ b/envs/monkey_zoo/blackbox/test_configurations/credentials_reuse_ssh_key.py @@ -10,6 +10,8 @@ from .utils import ( add_subnets, add_tcp_ports, replace_agent_configuration, + replace_propagation_credentials, + set_keep_tunnel_open_time, set_maximum_depth, ) @@ -45,7 +47,8 @@ def _add_tcp_ports(agent_configuration: AgentConfiguration) -> AgentConfiguratio return add_tcp_ports(agent_configuration, ports) -test_agent_configuration = set_maximum_depth(noop_test_configuration.agent_configuration, 1) +test_agent_configuration = set_maximum_depth(noop_test_configuration.agent_configuration, 3) +test_agent_configuration = set_keep_tunnel_open_time(test_agent_configuration, 20) test_agent_configuration = _add_exploiters(test_agent_configuration) test_agent_configuration = _add_subnets(test_agent_configuration) test_agent_configuration = _add_credential_collectors(test_agent_configuration) @@ -57,8 +60,12 @@ CREDENTIALS = ( Credentials(identity=None, secret=Password(password="5BuYHeVl")), ) -credential_reuse_ssh_key_test_configuration = dataclasses.replace(noop_test_configuration) +credentials_reuse_ssh_key_test_configuration = dataclasses.replace(noop_test_configuration) replace_agent_configuration( - test_configuration=credential_reuse_ssh_key_test_configuration, + test_configuration=credentials_reuse_ssh_key_test_configuration, agent_configuration=test_agent_configuration, ) +replace_propagation_credentials( + test_configuration=credentials_reuse_ssh_key_test_configuration, + propagation_credentials=CREDENTIALS, +)