BB: Get rid of TestConfigurationParser and move its functions outside
This commit is contained in:
parent
35d5592da0
commit
b6703becbc
|
@ -3,7 +3,5 @@ from typing import Iterable
|
||||||
from envs.monkey_zoo.blackbox.test_configurations.test_configuration import TestConfiguration
|
from envs.monkey_zoo.blackbox.test_configurations.test_configuration import TestConfiguration
|
||||||
|
|
||||||
|
|
||||||
class TestConfigurationParser:
|
def get_target_ips(test_configuration: TestConfiguration) -> Iterable[str]:
|
||||||
@staticmethod
|
return test_configuration.agent_configuration.propagation.network_scan.targets.subnets
|
||||||
def get_target_ips(test_configuration: TestConfiguration) -> Iterable[str]:
|
|
||||||
return test_configuration.agent_configuration.propagation.network_scan.targets.subnets
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ from envs.monkey_zoo.blackbox.analyzers.communication_analyzer import Communicat
|
||||||
from envs.monkey_zoo.blackbox.analyzers.zerologon_analyzer import ZerologonAnalyzer
|
from envs.monkey_zoo.blackbox.analyzers.zerologon_analyzer import ZerologonAnalyzer
|
||||||
from envs.monkey_zoo.blackbox.gcp_test_machine_list import GCP_TEST_MACHINE_LIST
|
from envs.monkey_zoo.blackbox.gcp_test_machine_list import GCP_TEST_MACHINE_LIST
|
||||||
from envs.monkey_zoo.blackbox.island_client.monkey_island_client import MonkeyIslandClient
|
from envs.monkey_zoo.blackbox.island_client.monkey_island_client import MonkeyIslandClient
|
||||||
from envs.monkey_zoo.blackbox.island_client.test_configuration_parser import TestConfigurationParser
|
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.log_handlers.test_logs_handler import TestLogsHandler
|
||||||
from envs.monkey_zoo.blackbox.test_configurations import (
|
from envs.monkey_zoo.blackbox.test_configurations import (
|
||||||
depth_1_a_test_configuration,
|
depth_1_a_test_configuration,
|
||||||
|
@ -87,7 +87,7 @@ class TestMonkeyBlackbox:
|
||||||
):
|
):
|
||||||
analyzer = CommunicationAnalyzer(
|
analyzer = CommunicationAnalyzer(
|
||||||
island_client,
|
island_client,
|
||||||
TestConfigurationParser.get_target_ips(test_configuration),
|
get_target_ips(test_configuration),
|
||||||
)
|
)
|
||||||
log_handler = TestLogsHandler(
|
log_handler = TestLogsHandler(
|
||||||
test_name, island_client, TestMonkeyBlackbox.get_log_dir_path()
|
test_name, island_client, TestMonkeyBlackbox.get_log_dir_path()
|
||||||
|
@ -142,7 +142,7 @@ class TestMonkeyBlackbox:
|
||||||
zero_logon_analyzer = ZerologonAnalyzer(island_client, expected_creds)
|
zero_logon_analyzer = ZerologonAnalyzer(island_client, expected_creds)
|
||||||
communication_analyzer = CommunicationAnalyzer(
|
communication_analyzer = CommunicationAnalyzer(
|
||||||
island_client,
|
island_client,
|
||||||
TestConfigurationParser.get_target_ips(zerologon_test_configuration),
|
get_target_ips(zerologon_test_configuration),
|
||||||
)
|
)
|
||||||
log_handler = TestLogsHandler(
|
log_handler = TestLogsHandler(
|
||||||
test_name, island_client, TestMonkeyBlackbox.get_log_dir_path()
|
test_name, island_client, TestMonkeyBlackbox.get_log_dir_path()
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import logging
|
import logging
|
||||||
from time import sleep
|
from time import sleep
|
||||||
|
|
||||||
from envs.monkey_zoo.blackbox.island_client.test_configuration_parser import TestConfigurationParser
|
from envs.monkey_zoo.blackbox.island_client.test_configuration_parser import get_target_ips
|
||||||
from envs.monkey_zoo.blackbox.tests.basic_test import BasicTest
|
from envs.monkey_zoo.blackbox.tests.basic_test import BasicTest
|
||||||
from envs.monkey_zoo.blackbox.utils.test_timer import TestTimer
|
from envs.monkey_zoo.blackbox.utils.test_timer import TestTimer
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ class ExploitationTest(BasicTest):
|
||||||
|
|
||||||
def print_test_starting_info(self):
|
def print_test_starting_info(self):
|
||||||
LOGGER.info("Started {} test".format(self.name))
|
LOGGER.info("Started {} test".format(self.name))
|
||||||
machine_list = ", ".join(TestConfigurationParser.get_target_ips(self.test_configuration))
|
machine_list = ", ".join(get_target_ips(self.test_configuration))
|
||||||
LOGGER.info(f"Machines participating in test: {machine_list}")
|
LOGGER.info(f"Machines participating in test: {machine_list}")
|
||||||
print("")
|
print("")
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue