forked from p15670423/monkey
BB: Use agent configuration object to get target IPs in IslandConfigParser
This commit is contained in:
parent
549a79ced4
commit
00626fe579
|
@ -11,7 +11,5 @@ class IslandConfigParser:
|
|||
return agent_configuration.to_json()
|
||||
|
||||
@staticmethod
|
||||
def get_target_ips_from_serialized_config(serialized_config: Mapping) -> Iterable:
|
||||
return dpath.util.get(
|
||||
serialized_config, "agent_configuration.propagation.network_scan.targets.subnets", "."
|
||||
)
|
||||
def get_target_ips_from_configuration(agent_configuration: AgentConfiguration) -> Iterable:
|
||||
return agent_configuration.propagation.network_scan.targets.subnets
|
||||
|
|
|
@ -92,7 +92,7 @@ class TestMonkeyBlackbox:
|
|||
serialized_config = IslandConfigParser.get_serialized_config(agent_configuration)
|
||||
analyzer = CommunicationAnalyzer(
|
||||
island_client,
|
||||
IslandConfigParser.get_target_ips_from_serialized_config(serialized_config),
|
||||
IslandConfigParser.get_target_ips_from_configuration(agent_configuration),
|
||||
)
|
||||
log_handler = TestLogsHandler(
|
||||
test_name, island_client, TestMonkeyBlackbox.get_log_dir_path()
|
||||
|
@ -100,7 +100,7 @@ class TestMonkeyBlackbox:
|
|||
ExploitationTest(
|
||||
name=test_name,
|
||||
island_client=island_client,
|
||||
serialized_config=serialized_config,
|
||||
agent_configuration=agent_configuration,
|
||||
analyzers=[analyzer],
|
||||
timeout=timeout_in_seconds,
|
||||
log_handler=log_handler,
|
||||
|
@ -148,7 +148,7 @@ class TestMonkeyBlackbox:
|
|||
zero_logon_analyzer = ZerologonAnalyzer(island_client, expected_creds)
|
||||
communication_analyzer = CommunicationAnalyzer(
|
||||
island_client,
|
||||
IslandConfigParser.get_target_ips_from_serialized_config(serialized_config),
|
||||
IslandConfigParser.get_target_ips_from_configuration(zerologon_test_configuration),
|
||||
)
|
||||
log_handler = TestLogsHandler(
|
||||
test_name, island_client, TestMonkeyBlackbox.get_log_dir_path()
|
||||
|
@ -156,7 +156,7 @@ class TestMonkeyBlackbox:
|
|||
ExploitationTest(
|
||||
name=test_name,
|
||||
island_client=island_client,
|
||||
serialized_config=serialized_config,
|
||||
agent_configuration=zerologon_test_configuration,
|
||||
analyzers=[zero_logon_analyzer, communication_analyzer],
|
||||
timeout=DEFAULT_TIMEOUT_SECONDS + 30,
|
||||
log_handler=log_handler,
|
||||
|
|
|
@ -13,10 +13,10 @@ LOGGER = logging.getLogger(__name__)
|
|||
|
||||
|
||||
class ExploitationTest(BasicTest):
|
||||
def __init__(self, name, island_client, serialized_config, analyzers, timeout, log_handler):
|
||||
def __init__(self, name, island_client, agent_configuration, analyzers, timeout, log_handler):
|
||||
self.name = name
|
||||
self.island_client = island_client
|
||||
self.serialized_config = serialized_config
|
||||
self.agent_configuration = agent_configuration
|
||||
self.analyzers = analyzers
|
||||
self.timeout = timeout
|
||||
self.log_handler = log_handler
|
||||
|
@ -37,7 +37,7 @@ class ExploitationTest(BasicTest):
|
|||
def print_test_starting_info(self):
|
||||
LOGGER.info("Started {} test".format(self.name))
|
||||
machine_list = ", ".join(
|
||||
IslandConfigParser.get_target_ips_from_serialized_config(self.serialized_config)
|
||||
IslandConfigParser.get_target_ips_from_configuration(self.agent_configuration)
|
||||
)
|
||||
LOGGER.info(f"Machines participating in test: {machine_list}")
|
||||
print("")
|
||||
|
|
Loading…
Reference in New Issue