From c985337df0b051ef8893e6e7624177571e358d53 Mon Sep 17 00:00:00 2001 From: Shreya Malviya Date: Thu, 1 Sep 2022 18:34:26 +0530 Subject: [PATCH] BB: Fix configuration modification logic in all test configurations since TestConfiguration is a dataclass --- envs/monkey_zoo/blackbox/test_configurations/depth_1_a.py | 4 +++- envs/monkey_zoo/blackbox/test_configurations/depth_2_a.py | 4 +++- envs/monkey_zoo/blackbox/test_configurations/depth_3_a.py | 4 +++- .../test_configurations/powershell_credentials_reuse.py | 4 +++- envs/monkey_zoo/blackbox/test_configurations/smb_pth.py | 4 +++- envs/monkey_zoo/blackbox/test_configurations/wmi_mimikatz.py | 4 +++- envs/monkey_zoo/blackbox/test_configurations/zerologon.py | 4 +++- 7 files changed, 21 insertions(+), 7 deletions(-) diff --git a/envs/monkey_zoo/blackbox/test_configurations/depth_1_a.py b/envs/monkey_zoo/blackbox/test_configurations/depth_1_a.py index 4c935ddb4..478aa7373 100644 --- a/envs/monkey_zoo/blackbox/test_configurations/depth_1_a.py +++ b/envs/monkey_zoo/blackbox/test_configurations/depth_1_a.py @@ -1,3 +1,5 @@ +import dataclasses + from common.agent_configuration import AgentConfiguration, PluginConfiguration from common.credentials import Credentials, Password, Username @@ -90,7 +92,7 @@ CREDENTIALS = ( Credentials(None, Password("Xk8VDTsC")), ) -depth_1_a_test_configuration = noop_test_configuration.copy() +depth_1_a_test_configuration = dataclasses.replace(noop_test_configuration) replace_agent_configuration( test_configuration=depth_1_a_test_configuration, agent_configuration=test_agent_configuration ) diff --git a/envs/monkey_zoo/blackbox/test_configurations/depth_2_a.py b/envs/monkey_zoo/blackbox/test_configurations/depth_2_a.py index a8b9a87a5..109a600fc 100644 --- a/envs/monkey_zoo/blackbox/test_configurations/depth_2_a.py +++ b/envs/monkey_zoo/blackbox/test_configurations/depth_2_a.py @@ -1,3 +1,5 @@ +import dataclasses + from common.agent_configuration import AgentConfiguration, PluginConfiguration from common.credentials import Credentials, Password, Username @@ -44,7 +46,7 @@ CREDENTIALS = ( Credentials(None, Password("^NgDvY59~8")), ) -depth_2_a_test_configuration = noop_test_configuration.copy() +depth_2_a_test_configuration = dataclasses.replace(noop_test_configuration) replace_agent_configuration( test_configuration=depth_2_a_test_configuration, agent_configuration=test_agent_configuration ) diff --git a/envs/monkey_zoo/blackbox/test_configurations/depth_3_a.py b/envs/monkey_zoo/blackbox/test_configurations/depth_3_a.py index a1de4430c..0a39a5e59 100644 --- a/envs/monkey_zoo/blackbox/test_configurations/depth_3_a.py +++ b/envs/monkey_zoo/blackbox/test_configurations/depth_3_a.py @@ -1,3 +1,5 @@ +import dataclasses + from common.agent_configuration import AgentConfiguration, PluginConfiguration from common.credentials import Credentials, NTHash, Password, Username @@ -66,7 +68,7 @@ CREDENTIALS = ( Credentials(None, NTHash("50c9987a6bf1ac59398df9f911122c9b")), ) -depth_3_a_test_configuration = noop_test_configuration.copy() +depth_3_a_test_configuration = dataclasses.replace(noop_test_configuration) replace_agent_configuration( test_configuration=depth_3_a_test_configuration, agent_configuration=test_agent_configuration ) diff --git a/envs/monkey_zoo/blackbox/test_configurations/powershell_credentials_reuse.py b/envs/monkey_zoo/blackbox/test_configurations/powershell_credentials_reuse.py index 7938b54e2..5d974cd17 100644 --- a/envs/monkey_zoo/blackbox/test_configurations/powershell_credentials_reuse.py +++ b/envs/monkey_zoo/blackbox/test_configurations/powershell_credentials_reuse.py @@ -1,3 +1,5 @@ +import dataclasses + from common.agent_configuration import AgentConfiguration, PluginConfiguration from .noop import noop_test_configuration @@ -35,7 +37,7 @@ test_agent_configuration = _add_exploiters(test_agent_configuration) test_agent_configuration = _add_subnets(test_agent_configuration) test_agent_configuration = _add_tcp_ports(test_agent_configuration) -powershell_credentials_reuse_test_configuration = noop_test_configuration.copy() +powershell_credentials_reuse_test_configuration = dataclasses.replace(noop_test_configuration) replace_agent_configuration( test_configuration=powershell_credentials_reuse_test_configuration, agent_configuration=test_agent_configuration, diff --git a/envs/monkey_zoo/blackbox/test_configurations/smb_pth.py b/envs/monkey_zoo/blackbox/test_configurations/smb_pth.py index b99d21ca8..f0432129d 100644 --- a/envs/monkey_zoo/blackbox/test_configurations/smb_pth.py +++ b/envs/monkey_zoo/blackbox/test_configurations/smb_pth.py @@ -1,3 +1,5 @@ +import dataclasses + from common.agent_configuration import AgentConfiguration, PluginConfiguration from common.credentials import Credentials, NTHash, Password, Username @@ -50,7 +52,7 @@ CREDENTIALS = ( Credentials(None, NTHash("50c9987a6bf1ac59398df9f911122c9b")), ) -smb_pth_test_configuration = noop_test_configuration.copy() +smb_pth_test_configuration = dataclasses.replace(noop_test_configuration) replace_agent_configuration( test_configuration=smb_pth_test_configuration, agent_configuration=test_agent_configuration ) diff --git a/envs/monkey_zoo/blackbox/test_configurations/wmi_mimikatz.py b/envs/monkey_zoo/blackbox/test_configurations/wmi_mimikatz.py index db8b6fa1d..dc86ee2c8 100644 --- a/envs/monkey_zoo/blackbox/test_configurations/wmi_mimikatz.py +++ b/envs/monkey_zoo/blackbox/test_configurations/wmi_mimikatz.py @@ -1,3 +1,5 @@ +import dataclasses + from common.agent_configuration import AgentConfiguration, PluginConfiguration from common.credentials import Credentials, Password, Username @@ -55,7 +57,7 @@ CREDENTIALS = ( Credentials(None, Password("Password1!")), ) -wmi_mimikatz_test_configuration = noop_test_configuration.copy() +wmi_mimikatz_test_configuration = dataclasses.replace(noop_test_configuration) replace_agent_configuration( test_configuration=wmi_mimikatz_test_configuration, agent_configuration=test_agent_configuration ) diff --git a/envs/monkey_zoo/blackbox/test_configurations/zerologon.py b/envs/monkey_zoo/blackbox/test_configurations/zerologon.py index 87b533aed..b56b7af05 100644 --- a/envs/monkey_zoo/blackbox/test_configurations/zerologon.py +++ b/envs/monkey_zoo/blackbox/test_configurations/zerologon.py @@ -1,3 +1,5 @@ +import dataclasses + from common.agent_configuration import AgentConfiguration, PluginConfiguration from .noop import noop_test_configuration @@ -32,7 +34,7 @@ test_agent_configuration = _add_exploiters(test_agent_configuration) test_agent_configuration = _add_tcp_ports(test_agent_configuration) test_agent_configuration = _add_subnets(test_agent_configuration) -zerologon_test_configuration = noop_test_configuration.copy() +zerologon_test_configuration = dataclasses.replace(noop_test_configuration) replace_agent_configuration( test_configuration=zerologon_test_configuration, agent_configuration=test_agent_configuration )