BB: Rename IslandConfigParser -> TestConfigurationParser

Even though the names start with "test", they shouldn't cause any issues
since we only run "test_blackbox.py".
This commit is contained in:
Shreya Malviya 2022-07-21 19:25:45 +05:30 committed by Mike Salvatore
parent 2764069aec
commit 379ada7a24
3 changed files with 6 additions and 6 deletions

View File

@ -3,7 +3,7 @@ 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 IslandConfigParser: class TestConfigurationParser:
@staticmethod @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 return test_configuration.agent_configuration.propagation.network_scan.targets.subnets

View File

@ -7,8 +7,8 @@ import pytest
from envs.monkey_zoo.blackbox.analyzers.communication_analyzer import CommunicationAnalyzer from envs.monkey_zoo.blackbox.analyzers.communication_analyzer import CommunicationAnalyzer
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.island_config_parser import IslandConfigParser
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.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,
@ -91,7 +91,7 @@ class TestMonkeyBlackbox:
): ):
analyzer = CommunicationAnalyzer( analyzer = CommunicationAnalyzer(
island_client, island_client,
IslandConfigParser.get_target_ips(test_configuration), TestConfigurationParser.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()
@ -146,7 +146,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,
IslandConfigParser.get_target_ips(zerologon_test_configuration), TestConfigurationParser.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()

View File

@ -1,7 +1,7 @@
import logging import logging
from time import sleep from time import sleep
from envs.monkey_zoo.blackbox.island_client.island_config_parser import IslandConfigParser from envs.monkey_zoo.blackbox.island_client.test_configuration_parser import TestConfigurationParser
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(IslandConfigParser.get_target_ips(self.test_configuration)) machine_list = ", ".join(TestConfigurationParser.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("")