From c7ee48fff1837ce522b0ba35bf94da3afe6ff5af Mon Sep 17 00:00:00 2001 From: Shreya Malviya Date: Tue, 30 Aug 2022 18:12:46 +0530 Subject: [PATCH] BB: Remove unneeded configuration replacing functions --- .../blackbox/test_configurations/utils.py | 74 +------------------ 1 file changed, 2 insertions(+), 72 deletions(-) diff --git a/envs/monkey_zoo/blackbox/test_configurations/utils.py b/envs/monkey_zoo/blackbox/test_configurations/utils.py index 29ee47c6b..d5bad8afc 100644 --- a/envs/monkey_zoo/blackbox/test_configurations/utils.py +++ b/envs/monkey_zoo/blackbox/test_configurations/utils.py @@ -1,18 +1,6 @@ -from dataclasses import replace -from typing import Sequence, Tuple +from typing import Sequence -from common.agent_configuration import ( - AgentConfiguration, - ExploitationConfiguration, - ExploitationOptionsConfiguration, - NetworkScanConfiguration, - PluginConfiguration, - PropagationConfiguration, - ScanTargetConfiguration, -) -from common.credentials import Credentials - -from . import TestConfiguration +from common.agent_configuration import AgentConfiguration, PluginConfiguration def add_exploiters( @@ -88,61 +76,3 @@ def set_maximum_depth( agent_configuration.propagation.maximum_depth = maximum_depth return agent_configuration - - -def replace_exploitation_configuration( - agent_configuration: AgentConfiguration, exploitation_configuration: ExploitationConfiguration -) -> AgentConfiguration: - propagation_configuration = replace( - agent_configuration.propagation, exploitation=exploitation_configuration - ) - - return replace_propagation_configuration(agent_configuration, propagation_configuration) - - -def replace_scan_target_configuration( - agent_configuration: AgentConfiguration, scan_target_configuration: ScanTargetConfiguration -) -> AgentConfiguration: - network_scan_configuration = replace( - agent_configuration.propagation.network_scan, targets=scan_target_configuration - ) - - return replace_network_scan_configuration(agent_configuration, network_scan_configuration) - - -def replace_network_scan_configuration( - agent_configuration: AgentConfiguration, network_scan_configuration: NetworkScanConfiguration -) -> AgentConfiguration: - propagation_configuration = replace( - agent_configuration.propagation, network_scan=network_scan_configuration - ) - return replace_propagation_configuration(agent_configuration, propagation_configuration) - - -def replace_propagation_configuration( - agent_configuration: AgentConfiguration, propagation_configuration: PropagationConfiguration -) -> AgentConfiguration: - return replace(agent_configuration, propagation=propagation_configuration) - - -def replace_exploitation_options_configuration( - agent_configuration: AgentConfiguration, - exploitation_options_configuration: ExploitationOptionsConfiguration, -) -> AgentConfiguration: - exploitation_configuration = agent_configuration.propagation.exploitation - exploitation_configuration = replace( - exploitation_configuration, options=exploitation_options_configuration - ) - return replace_exploitation_configuration(agent_configuration, exploitation_configuration) - - -def replace_agent_configuration( - test_configuration: TestConfiguration, agent_configuration: AgentConfiguration -) -> TestConfiguration: - return replace(test_configuration, agent_configuration=agent_configuration) - - -def replace_propagation_credentials( - test_configuration: TestConfiguration, propagation_credentials: Tuple[Credentials, ...] -): - return replace(test_configuration, propagation_credentials=propagation_credentials)