forked from p15670423/monkey
BB: Use `replace_agent_configuration()` and `replace_propagation_credentials()` for all test configuration modifications
This commit is contained in:
parent
2352bb0d5e
commit
6cf62d48cb
|
@ -9,6 +9,8 @@ from .utils import (
|
||||||
add_http_ports,
|
add_http_ports,
|
||||||
add_subnets,
|
add_subnets,
|
||||||
add_tcp_ports,
|
add_tcp_ports,
|
||||||
|
replace_agent_configuration,
|
||||||
|
replace_propagation_credentials,
|
||||||
set_maximum_depth,
|
set_maximum_depth,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -89,5 +91,9 @@ CREDENTIALS = (
|
||||||
)
|
)
|
||||||
|
|
||||||
depth_1_a_test_configuration = noop_test_configuration.copy()
|
depth_1_a_test_configuration = noop_test_configuration.copy()
|
||||||
depth_1_a_test_configuration.agent_configuration = test_agent_configuration
|
replace_agent_configuration(
|
||||||
depth_1_a_test_configuration.propagation_credentials = CREDENTIALS
|
test_configuration=depth_1_a_test_configuration, agent_configuration=test_agent_configuration
|
||||||
|
)
|
||||||
|
replace_propagation_credentials(
|
||||||
|
test_configuration=depth_1_a_test_configuration, propagation_credentials=CREDENTIALS
|
||||||
|
)
|
||||||
|
|
|
@ -2,7 +2,14 @@ from common.agent_configuration import AgentConfiguration, PluginConfiguration
|
||||||
from common.credentials import Credentials, Password, Username
|
from common.credentials import Credentials, Password, Username
|
||||||
|
|
||||||
from .noop import noop_test_configuration
|
from .noop import noop_test_configuration
|
||||||
from .utils import add_exploiters, add_subnets, add_tcp_ports, set_maximum_depth
|
from .utils import (
|
||||||
|
add_exploiters,
|
||||||
|
add_subnets,
|
||||||
|
add_tcp_ports,
|
||||||
|
replace_agent_configuration,
|
||||||
|
replace_propagation_credentials,
|
||||||
|
set_maximum_depth,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
# Tests:
|
# Tests:
|
||||||
|
@ -38,5 +45,9 @@ CREDENTIALS = (
|
||||||
)
|
)
|
||||||
|
|
||||||
depth_2_a_test_configuration = noop_test_configuration.copy()
|
depth_2_a_test_configuration = noop_test_configuration.copy()
|
||||||
depth_2_a_test_configuration.agent_configuration = test_agent_configuration
|
replace_agent_configuration(
|
||||||
depth_2_a_test_configuration.propagation_credentials = CREDENTIALS
|
test_configuration=depth_2_a_test_configuration, agent_configuration=test_agent_configuration
|
||||||
|
)
|
||||||
|
replace_propagation_credentials(
|
||||||
|
test_configuration=depth_2_a_test_configuration, propagation_credentials=CREDENTIALS
|
||||||
|
)
|
||||||
|
|
|
@ -6,6 +6,8 @@ from .utils import (
|
||||||
add_exploiters,
|
add_exploiters,
|
||||||
add_subnets,
|
add_subnets,
|
||||||
add_tcp_ports,
|
add_tcp_ports,
|
||||||
|
replace_agent_configuration,
|
||||||
|
replace_propagation_credentials,
|
||||||
set_keep_tunnel_open_time,
|
set_keep_tunnel_open_time,
|
||||||
set_maximum_depth,
|
set_maximum_depth,
|
||||||
)
|
)
|
||||||
|
@ -65,5 +67,9 @@ CREDENTIALS = (
|
||||||
)
|
)
|
||||||
|
|
||||||
depth_3_a_test_configuration = noop_test_configuration.copy()
|
depth_3_a_test_configuration = noop_test_configuration.copy()
|
||||||
depth_3_a_test_configuration.agent_configuration = test_agent_configuration
|
replace_agent_configuration(
|
||||||
depth_3_a_test_configuration.propagation_credentials = CREDENTIALS
|
test_configuration=depth_3_a_test_configuration, agent_configuration=test_agent_configuration
|
||||||
|
)
|
||||||
|
replace_propagation_credentials(
|
||||||
|
test_configuration=depth_3_a_test_configuration, propagation_credentials=CREDENTIALS
|
||||||
|
)
|
||||||
|
|
|
@ -1,7 +1,13 @@
|
||||||
from common.agent_configuration import AgentConfiguration, PluginConfiguration
|
from common.agent_configuration import AgentConfiguration, PluginConfiguration
|
||||||
|
|
||||||
from .noop import noop_test_configuration
|
from .noop import noop_test_configuration
|
||||||
from .utils import add_exploiters, add_subnets, add_tcp_ports, set_maximum_depth
|
from .utils import (
|
||||||
|
add_exploiters,
|
||||||
|
add_subnets,
|
||||||
|
add_tcp_ports,
|
||||||
|
replace_agent_configuration,
|
||||||
|
set_maximum_depth,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def _add_exploiters(agent_configuration: AgentConfiguration) -> AgentConfiguration:
|
def _add_exploiters(agent_configuration: AgentConfiguration) -> AgentConfiguration:
|
||||||
|
@ -30,4 +36,7 @@ test_agent_configuration = _add_subnets(test_agent_configuration)
|
||||||
test_agent_configuration = _add_tcp_ports(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 = noop_test_configuration.copy()
|
||||||
powershell_credentials_reuse_test_configuration.agent_configuration = test_agent_configuration
|
replace_agent_configuration(
|
||||||
|
test_configuration=powershell_credentials_reuse_test_configuration,
|
||||||
|
agent_configuration=test_agent_configuration,
|
||||||
|
)
|
||||||
|
|
|
@ -6,6 +6,8 @@ from .utils import (
|
||||||
add_exploiters,
|
add_exploiters,
|
||||||
add_subnets,
|
add_subnets,
|
||||||
add_tcp_ports,
|
add_tcp_ports,
|
||||||
|
replace_agent_configuration,
|
||||||
|
replace_propagation_credentials,
|
||||||
set_keep_tunnel_open_time,
|
set_keep_tunnel_open_time,
|
||||||
set_maximum_depth,
|
set_maximum_depth,
|
||||||
)
|
)
|
||||||
|
@ -49,5 +51,9 @@ CREDENTIALS = (
|
||||||
)
|
)
|
||||||
|
|
||||||
smb_pth_test_configuration = noop_test_configuration.copy()
|
smb_pth_test_configuration = noop_test_configuration.copy()
|
||||||
smb_pth_test_configuration.agent_configuration = test_agent_configuration
|
replace_agent_configuration(
|
||||||
smb_pth_test_configuration.propagation_credentials = CREDENTIALS
|
test_configuration=smb_pth_test_configuration, agent_configuration=test_agent_configuration
|
||||||
|
)
|
||||||
|
replace_propagation_credentials(
|
||||||
|
test_configuration=smb_pth_test_configuration, propagation_credentials=CREDENTIALS
|
||||||
|
)
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
from typing import Sequence
|
from typing import Sequence, Tuple
|
||||||
|
|
||||||
from common.agent_configuration import AgentConfiguration, PluginConfiguration
|
from common.agent_configuration import AgentConfiguration, PluginConfiguration
|
||||||
|
from common.credentials import Credentials
|
||||||
|
from envs.monkey_zoo.blackbox.test_configurations.test_configuration import TestConfiguration
|
||||||
|
|
||||||
|
|
||||||
def add_exploiters(
|
def add_exploiters(
|
||||||
|
@ -84,3 +86,15 @@ def set_maximum_depth(
|
||||||
agent_configuration_copy.propagation.maximum_depth = maximum_depth
|
agent_configuration_copy.propagation.maximum_depth = maximum_depth
|
||||||
|
|
||||||
return agent_configuration_copy
|
return agent_configuration_copy
|
||||||
|
|
||||||
|
|
||||||
|
def replace_agent_configuration(
|
||||||
|
test_configuration: TestConfiguration, agent_configuration: AgentConfiguration
|
||||||
|
):
|
||||||
|
test_configuration.agent_configuration = agent_configuration
|
||||||
|
|
||||||
|
|
||||||
|
def replace_propagation_credentials(
|
||||||
|
test_configuration: TestConfiguration, propagation_credentials: Tuple[Credentials, ...]
|
||||||
|
):
|
||||||
|
test_configuration.propagation_credentials = propagation_credentials
|
||||||
|
|
|
@ -7,6 +7,8 @@ from .utils import (
|
||||||
add_exploiters,
|
add_exploiters,
|
||||||
add_subnets,
|
add_subnets,
|
||||||
add_tcp_ports,
|
add_tcp_ports,
|
||||||
|
replace_agent_configuration,
|
||||||
|
replace_propagation_credentials,
|
||||||
set_maximum_depth,
|
set_maximum_depth,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -54,5 +56,9 @@ CREDENTIALS = (
|
||||||
)
|
)
|
||||||
|
|
||||||
wmi_mimikatz_test_configuration = noop_test_configuration.copy()
|
wmi_mimikatz_test_configuration = noop_test_configuration.copy()
|
||||||
wmi_mimikatz_test_configuration.agent_configuration = test_agent_configuration
|
replace_agent_configuration(
|
||||||
wmi_mimikatz_test_configuration.propagation_credentials = CREDENTIALS
|
test_configuration=wmi_mimikatz_test_configuration, agent_configuration=test_agent_configuration
|
||||||
|
)
|
||||||
|
replace_propagation_credentials(
|
||||||
|
test_configuration=wmi_mimikatz_test_configuration, propagation_credentials=CREDENTIALS
|
||||||
|
)
|
||||||
|
|
|
@ -1,7 +1,13 @@
|
||||||
from common.agent_configuration import AgentConfiguration, PluginConfiguration
|
from common.agent_configuration import AgentConfiguration, PluginConfiguration
|
||||||
|
|
||||||
from .noop import noop_test_configuration
|
from .noop import noop_test_configuration
|
||||||
from .utils import add_exploiters, add_subnets, add_tcp_ports, set_maximum_depth
|
from .utils import (
|
||||||
|
add_exploiters,
|
||||||
|
add_subnets,
|
||||||
|
add_tcp_ports,
|
||||||
|
replace_agent_configuration,
|
||||||
|
set_maximum_depth,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def _add_exploiters(agent_configuration: AgentConfiguration) -> AgentConfiguration:
|
def _add_exploiters(agent_configuration: AgentConfiguration) -> AgentConfiguration:
|
||||||
|
@ -27,4 +33,6 @@ test_agent_configuration = _add_tcp_ports(test_agent_configuration)
|
||||||
test_agent_configuration = _add_subnets(test_agent_configuration)
|
test_agent_configuration = _add_subnets(test_agent_configuration)
|
||||||
|
|
||||||
zerologon_test_configuration = noop_test_configuration.copy()
|
zerologon_test_configuration = noop_test_configuration.copy()
|
||||||
zerologon_test_configuration.agent_configuration = test_agent_configuration
|
replace_agent_configuration(
|
||||||
|
test_configuration=zerologon_test_configuration, agent_configuration=test_agent_configuration
|
||||||
|
)
|
||||||
|
|
Loading…
Reference in New Issue