BB: Get rid of TestConfigurationParser and move its functions outside

This commit is contained in:
Shreya Malviya 2022-07-22 12:54:20 +05:30 committed by Mike Salvatore
parent 35d5592da0
commit b6703becbc
3 changed files with 7 additions and 9 deletions

View File

@ -3,7 +3,5 @@ from typing import Iterable
from envs.monkey_zoo.blackbox.test_configurations.test_configuration import TestConfiguration
class TestConfigurationParser:
@staticmethod
def get_target_ips(test_configuration: TestConfiguration) -> Iterable[str]:
def get_target_ips(test_configuration: TestConfiguration) -> Iterable[str]:
return test_configuration.agent_configuration.propagation.network_scan.targets.subnets

View File

@ -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.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.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.test_configurations import (
depth_1_a_test_configuration,
@ -87,7 +87,7 @@ class TestMonkeyBlackbox:
):
analyzer = CommunicationAnalyzer(
island_client,
TestConfigurationParser.get_target_ips(test_configuration),
get_target_ips(test_configuration),
)
log_handler = TestLogsHandler(
test_name, island_client, TestMonkeyBlackbox.get_log_dir_path()
@ -142,7 +142,7 @@ class TestMonkeyBlackbox:
zero_logon_analyzer = ZerologonAnalyzer(island_client, expected_creds)
communication_analyzer = CommunicationAnalyzer(
island_client,
TestConfigurationParser.get_target_ips(zerologon_test_configuration),
get_target_ips(zerologon_test_configuration),
)
log_handler = TestLogsHandler(
test_name, island_client, TestMonkeyBlackbox.get_log_dir_path()

View File

@ -1,7 +1,7 @@
import logging
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.utils.test_timer import TestTimer
@ -36,7 +36,7 @@ class ExploitationTest(BasicTest):
def print_test_starting_info(self):
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}")
print("")