From 70f3506317d4dd489c72830f6bf1f43eba0f0ec5 Mon Sep 17 00:00:00 2001 From: Mike Salvatore Date: Mon, 18 Jul 2022 13:02:19 -0400 Subject: [PATCH 1/4] BB: Remove test_blackbox_in_depth.py --- .../blackbox/test_blackbox_in_depth.py | 281 ------------------ 1 file changed, 281 deletions(-) delete mode 100644 envs/monkey_zoo/blackbox/test_blackbox_in_depth.py diff --git a/envs/monkey_zoo/blackbox/test_blackbox_in_depth.py b/envs/monkey_zoo/blackbox/test_blackbox_in_depth.py deleted file mode 100644 index f80912681..000000000 --- a/envs/monkey_zoo/blackbox/test_blackbox_in_depth.py +++ /dev/null @@ -1,281 +0,0 @@ -import logging -import os -from time import sleep - -import pytest -from typing_extensions import Type - -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.config_templates.config_template import ConfigTemplate -from envs.monkey_zoo.blackbox.config_templates.single_tests.hadoop import Hadoop -from envs.monkey_zoo.blackbox.config_templates.single_tests.log4j_logstash import Log4jLogstash -from envs.monkey_zoo.blackbox.config_templates.single_tests.log4j_solr import Log4jSolr -from envs.monkey_zoo.blackbox.config_templates.single_tests.log4j_tomcat import Log4jTomcat -from envs.monkey_zoo.blackbox.config_templates.single_tests.mssql import Mssql -from envs.monkey_zoo.blackbox.config_templates.single_tests.performance import Performance -from envs.monkey_zoo.blackbox.config_templates.single_tests.powershell import PowerShell -from envs.monkey_zoo.blackbox.config_templates.single_tests.powershell_credentials_reuse import ( - PowerShellCredentialsReuse, -) -from envs.monkey_zoo.blackbox.config_templates.single_tests.smb_mimikatz import SmbMimikatz -from envs.monkey_zoo.blackbox.config_templates.single_tests.smb_pth import SmbPth -from envs.monkey_zoo.blackbox.config_templates.single_tests.ssh import Ssh -from envs.monkey_zoo.blackbox.config_templates.single_tests.tunneling import Tunneling -from envs.monkey_zoo.blackbox.config_templates.single_tests.wmi_mimikatz import WmiMimikatz -from envs.monkey_zoo.blackbox.config_templates.single_tests.wmi_pth import WmiPth -from envs.monkey_zoo.blackbox.config_templates.single_tests.zerologon import Zerologon -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.log_handlers.test_logs_handler import TestLogsHandler -from envs.monkey_zoo.blackbox.tests.exploitation import ExploitationTest -from envs.monkey_zoo.blackbox.tests.performance.map_generation import MapGenerationTest -from envs.monkey_zoo.blackbox.tests.performance.map_generation_from_telemetries import ( - MapGenerationFromTelemetryTest, -) -from envs.monkey_zoo.blackbox.tests.performance.report_generation import ReportGenerationTest -from envs.monkey_zoo.blackbox.tests.performance.report_generation_from_telemetries import ( - ReportGenerationFromTelemetryTest, -) -from envs.monkey_zoo.blackbox.tests.performance.telemetry_performance_test import ( - TelemetryPerformanceTest, -) -from envs.monkey_zoo.blackbox.utils.gcp_machine_handlers import ( - initialize_gcp_client, - start_machines, - stop_machines, -) -from monkey_island.cc.services.mode.mode_enum import IslandModeEnum - -DEFAULT_TIMEOUT_SECONDS = 2 * 60 -MACHINE_BOOTUP_WAIT_SECONDS = 30 -LOG_DIR_PATH = "./logs" -logging.basicConfig(level=logging.INFO) -LOGGER = logging.getLogger(__name__) - - -@pytest.fixture(autouse=True, scope="session") -def GCPHandler(request, no_gcp): - if not no_gcp: - try: - initialize_gcp_client() - start_machines(GCP_TEST_MACHINE_LIST) - except Exception as e: - LOGGER.error("GCP Handler failed to initialize: %s." % e) - pytest.exit("Encountered an error while starting GCP machines. Stopping the tests.") - wait_machine_bootup() - - def fin(): - stop_machines(GCP_TEST_MACHINE_LIST) - - request.addfinalizer(fin) - - -@pytest.fixture(autouse=True, scope="session") -def delete_logs(): - LOGGER.info("Deleting monkey logs before new tests.") - TestLogsHandler.delete_log_folder_contents(TestMonkeyBlackbox.get_log_dir_path()) - - -def wait_machine_bootup(): - sleep(MACHINE_BOOTUP_WAIT_SECONDS) - - -@pytest.fixture(scope="class") -def island_client(island, quick_performance_tests): - client_established = False - try: - island_client_object = MonkeyIslandClient(island) - client_established = island_client_object.get_api_status() - except Exception: - logging.exception("Got an exception while trying to establish connection to the Island.") - finally: - if not client_established: - pytest.exit("BB tests couldn't establish communication to the island.") - if not quick_performance_tests: - island_client_object.reset_env() - island_client_object.set_scenario(IslandModeEnum.ADVANCED.value) - yield island_client_object - - -@pytest.mark.usefixtures("island_client") -# noinspection PyUnresolvedReferences -class TestMonkeyBlackbox: - @staticmethod - def run_exploitation_test( - island_client: MonkeyIslandClient, - config_template: Type[ConfigTemplate], - test_name: str, - timeout_in_seconds=DEFAULT_TIMEOUT_SECONDS, - ): - raw_config = IslandConfigParser.get_raw_config(config_template, island_client) - analyzer = CommunicationAnalyzer( - island_client, IslandConfigParser.get_ips_of_targets(raw_config) - ) - log_handler = TestLogsHandler( - test_name, island_client, TestMonkeyBlackbox.get_log_dir_path() - ) - ExploitationTest( - name=test_name, - island_client=island_client, - raw_config=raw_config, - analyzers=[analyzer], - timeout=timeout_in_seconds, - log_handler=log_handler, - ).run() - - @staticmethod - def run_performance_test( - performance_test_class, - island_client, - config_template, - timeout_in_seconds, - break_on_timeout=False, - ): - raw_config = IslandConfigParser.get_raw_config(config_template, island_client) - log_handler = TestLogsHandler( - performance_test_class.TEST_NAME, island_client, TestMonkeyBlackbox.get_log_dir_path() - ) - analyzers = [ - CommunicationAnalyzer(island_client, IslandConfigParser.get_ips_of_targets(raw_config)) - ] - performance_test_class( - island_client=island_client, - raw_config=raw_config, - analyzers=analyzers, - timeout=timeout_in_seconds, - log_handler=log_handler, - break_on_timeout=break_on_timeout, - ).run() - - @staticmethod - def get_log_dir_path(): - return os.path.abspath(LOG_DIR_PATH) - - def test_ssh_exploiter(self, island_client): - TestMonkeyBlackbox.run_exploitation_test(island_client, Ssh, "SSH_exploiter_and_keys") - - def test_hadoop_exploiter(self, island_client): - TestMonkeyBlackbox.run_exploitation_test(island_client, Hadoop, "Hadoop_exploiter", 6 * 60) - - def test_mssql_exploiter(self, island_client): - TestMonkeyBlackbox.run_exploitation_test(island_client, Mssql, "MSSQL_exploiter") - - def test_powershell_exploiter(self, island_client): - TestMonkeyBlackbox.run_exploitation_test( - island_client, PowerShell, "PowerShell_Remoting_exploiter" - ) - - @pytest.mark.skip_powershell_reuse - def test_powershell_exploiter_credentials_reuse(self, island_client): - TestMonkeyBlackbox.run_exploitation_test( - island_client, - PowerShellCredentialsReuse, - "PowerShell_Remoting_exploiter_credentials_reuse", - ) - - def test_smb_and_mimikatz_exploiters(self, island_client): - TestMonkeyBlackbox.run_exploitation_test( - island_client, SmbMimikatz, "SMB_exploiter_mimikatz" - ) - - def test_smb_pth(self, island_client): - TestMonkeyBlackbox.run_exploitation_test(island_client, SmbPth, "SMB_PTH") - - def test_log4j_solr_exploiter(self, island_client): - TestMonkeyBlackbox.run_exploitation_test( - island_client, Log4jSolr, "Log4Shell_Solr_exploiter" - ) - - def test_log4j_tomcat_exploiter(self, island_client): - TestMonkeyBlackbox.run_exploitation_test( - island_client, Log4jTomcat, "Log4Shell_tomcat_exploiter" - ) - - def test_log4j_logstash_exploiter(self, island_client): - TestMonkeyBlackbox.run_exploitation_test( - island_client, Log4jLogstash, "Log4Shell_logstash_exploiter" - ) - - def test_tunneling(self, island_client): - TestMonkeyBlackbox.run_exploitation_test( - island_client, Tunneling, "Tunneling_exploiter", 3 * 60 - ) - - def test_wmi_and_mimikatz_exploiters(self, island_client): - TestMonkeyBlackbox.run_exploitation_test( - island_client, WmiMimikatz, "WMI_exploiter,_mimikatz" - ) - - def test_wmi_pth(self, island_client): - TestMonkeyBlackbox.run_exploitation_test(island_client, WmiPth, "WMI_PTH") - - def test_zerologon_exploiter(self, island_client): - test_name = "Zerologon_exploiter" - expected_creds = [ - "Administrator", - "aad3b435b51404eeaad3b435b51404ee", - "2864b62ea4496934a5d6e86f50b834a5", - ] - raw_config = IslandConfigParser.get_raw_config(Zerologon, island_client) - zero_logon_analyzer = ZerologonAnalyzer(island_client, expected_creds) - communication_analyzer = CommunicationAnalyzer( - island_client, IslandConfigParser.get_ips_of_targets(raw_config) - ) - log_handler = TestLogsHandler( - test_name, island_client, TestMonkeyBlackbox.get_log_dir_path() - ) - ExploitationTest( - name=test_name, - island_client=island_client, - raw_config=raw_config, - analyzers=[zero_logon_analyzer, communication_analyzer], - timeout=DEFAULT_TIMEOUT_SECONDS, - log_handler=log_handler, - ).run() - - @pytest.mark.skip( - reason="Perfomance test that creates env from fake telemetries is faster, use that instead." - ) - def test_report_generation_performance(self, island_client, quick_performance_tests): - """ - This test includes the SSH + Hadoop + MSSQL machines all in one test - for a total of 8 machines including the Monkey Island. - - Is has 2 analyzers - the regular one which checks all the Monkeys - and the Timing one which checks how long the report took to execute - """ - if not quick_performance_tests: - TestMonkeyBlackbox.run_performance_test( - ReportGenerationTest, island_client, Performance, timeout_in_seconds=10 * 60 - ) - else: - LOGGER.error("This test doesn't support 'quick_performance_tests' option.") - assert False - - @pytest.mark.skip( - reason="Perfomance test that creates env from fake telemetries is faster, use that instead." - ) - def test_map_generation_performance(self, island_client, quick_performance_tests): - if not quick_performance_tests: - TestMonkeyBlackbox.run_performance_test( - MapGenerationTest, island_client, "PERFORMANCE.conf", timeout_in_seconds=10 * 60 - ) - else: - LOGGER.error("This test doesn't support 'quick_performance_tests' option.") - assert False - - @pytest.mark.run_performance_tests - def test_report_generation_from_fake_telemetries(self, island_client, quick_performance_tests): - ReportGenerationFromTelemetryTest(island_client, quick_performance_tests).run() - - @pytest.mark.run_performance_tests - def test_map_generation_from_fake_telemetries(self, island_client, quick_performance_tests): - MapGenerationFromTelemetryTest(island_client, quick_performance_tests).run() - - @pytest.mark.run_performance_tests - def test_telem_performance(self, island_client, quick_performance_tests): - TelemetryPerformanceTest( - island_client, quick_performance_tests - ).test_telemetry_performance() From c1073bd1ea5b53405333513559999632ac30ef20 Mon Sep 17 00:00:00 2001 From: Mike Salvatore Date: Mon, 18 Jul 2022 13:06:00 -0400 Subject: [PATCH 2/4] BB: Remove unused "single_tests" --- .../config_templates/single_tests/__init__.py | 0 .../config_templates/single_tests/hadoop.py | 18 ------ .../single_tests/log4j_logstash.py | 16 ----- .../single_tests/log4j_solr.py | 16 ----- .../single_tests/log4j_tomcat.py | 16 ----- .../config_templates/single_tests/mssql.py | 25 -------- .../single_tests/performance.py | 60 ------------------- .../single_tests/powershell.py | 29 --------- .../single_tests/smb_mimikatz.py | 23 ------- .../config_templates/single_tests/ssh.py | 21 ------- .../single_tests/tunneling.py | 35 ----------- .../config_templates/single_tests/wmi_pth.py | 24 -------- 12 files changed, 283 deletions(-) delete mode 100644 envs/monkey_zoo/blackbox/config_templates/single_tests/__init__.py delete mode 100644 envs/monkey_zoo/blackbox/config_templates/single_tests/hadoop.py delete mode 100644 envs/monkey_zoo/blackbox/config_templates/single_tests/log4j_logstash.py delete mode 100644 envs/monkey_zoo/blackbox/config_templates/single_tests/log4j_solr.py delete mode 100644 envs/monkey_zoo/blackbox/config_templates/single_tests/log4j_tomcat.py delete mode 100644 envs/monkey_zoo/blackbox/config_templates/single_tests/mssql.py delete mode 100644 envs/monkey_zoo/blackbox/config_templates/single_tests/performance.py delete mode 100644 envs/monkey_zoo/blackbox/config_templates/single_tests/powershell.py delete mode 100644 envs/monkey_zoo/blackbox/config_templates/single_tests/smb_mimikatz.py delete mode 100644 envs/monkey_zoo/blackbox/config_templates/single_tests/ssh.py delete mode 100644 envs/monkey_zoo/blackbox/config_templates/single_tests/tunneling.py delete mode 100644 envs/monkey_zoo/blackbox/config_templates/single_tests/wmi_pth.py diff --git a/envs/monkey_zoo/blackbox/config_templates/single_tests/__init__.py b/envs/monkey_zoo/blackbox/config_templates/single_tests/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/envs/monkey_zoo/blackbox/config_templates/single_tests/hadoop.py b/envs/monkey_zoo/blackbox/config_templates/single_tests/hadoop.py deleted file mode 100644 index 8238909fd..000000000 --- a/envs/monkey_zoo/blackbox/config_templates/single_tests/hadoop.py +++ /dev/null @@ -1,18 +0,0 @@ -from copy import copy - -from envs.monkey_zoo.blackbox.config_templates.base_template import BaseTemplate -from envs.monkey_zoo.blackbox.config_templates.config_template import ConfigTemplate - - -class Hadoop(ConfigTemplate): - - config_values = copy(BaseTemplate.config_values) - - config_values.update( - { - "basic.exploiters.exploiter_classes": ["HadoopExploiter"], - "basic_network.scope.subnet_scan_list": ["10.2.2.2", "10.2.2.3"], - "internal.network.tcp_scanner.HTTP_PORTS": [], - "internal.network.tcp_scanner.tcp_target_ports": [8088], - } - ) diff --git a/envs/monkey_zoo/blackbox/config_templates/single_tests/log4j_logstash.py b/envs/monkey_zoo/blackbox/config_templates/single_tests/log4j_logstash.py deleted file mode 100644 index 9f39a38c7..000000000 --- a/envs/monkey_zoo/blackbox/config_templates/single_tests/log4j_logstash.py +++ /dev/null @@ -1,16 +0,0 @@ -from copy import copy - -from envs.monkey_zoo.blackbox.config_templates.base_template import BaseTemplate -from envs.monkey_zoo.blackbox.config_templates.config_template import ConfigTemplate - - -class Log4jLogstash(ConfigTemplate): - - config_values = copy(BaseTemplate.config_values) - - config_values.update( - { - "basic.exploiters.exploiter_classes": ["Log4ShellExploiter"], - "basic_network.scope.subnet_scan_list": ["10.2.3.55", "10.2.3.56"], - } - ) diff --git a/envs/monkey_zoo/blackbox/config_templates/single_tests/log4j_solr.py b/envs/monkey_zoo/blackbox/config_templates/single_tests/log4j_solr.py deleted file mode 100644 index 77d513e74..000000000 --- a/envs/monkey_zoo/blackbox/config_templates/single_tests/log4j_solr.py +++ /dev/null @@ -1,16 +0,0 @@ -from copy import copy - -from envs.monkey_zoo.blackbox.config_templates.base_template import BaseTemplate -from envs.monkey_zoo.blackbox.config_templates.config_template import ConfigTemplate - - -class Log4jSolr(ConfigTemplate): - - config_values = copy(BaseTemplate.config_values) - - config_values.update( - { - "basic.exploiters.exploiter_classes": ["Log4ShellExploiter"], - "basic_network.scope.subnet_scan_list": ["10.2.3.49", "10.2.3.50"], - } - ) diff --git a/envs/monkey_zoo/blackbox/config_templates/single_tests/log4j_tomcat.py b/envs/monkey_zoo/blackbox/config_templates/single_tests/log4j_tomcat.py deleted file mode 100644 index 29a2269a0..000000000 --- a/envs/monkey_zoo/blackbox/config_templates/single_tests/log4j_tomcat.py +++ /dev/null @@ -1,16 +0,0 @@ -from copy import copy - -from envs.monkey_zoo.blackbox.config_templates.base_template import BaseTemplate -from envs.monkey_zoo.blackbox.config_templates.config_template import ConfigTemplate - - -class Log4jTomcat(ConfigTemplate): - - config_values = copy(BaseTemplate.config_values) - - config_values.update( - { - "basic.exploiters.exploiter_classes": ["Log4ShellExploiter"], - "basic_network.scope.subnet_scan_list": ["10.2.3.51", "10.2.3.52"], - } - ) diff --git a/envs/monkey_zoo/blackbox/config_templates/single_tests/mssql.py b/envs/monkey_zoo/blackbox/config_templates/single_tests/mssql.py deleted file mode 100644 index 403fc0060..000000000 --- a/envs/monkey_zoo/blackbox/config_templates/single_tests/mssql.py +++ /dev/null @@ -1,25 +0,0 @@ -from copy import copy - -from envs.monkey_zoo.blackbox.config_templates.base_template import BaseTemplate -from envs.monkey_zoo.blackbox.config_templates.config_template import ConfigTemplate - - -class Mssql(ConfigTemplate): - config_values = copy(BaseTemplate.config_values) - - config_values.update( - { - "basic.exploiters.exploiter_classes": ["MSSQLExploiter"], - "internal.classes.finger_classes": [], - "basic_network.scope.subnet_scan_list": ["10.2.2.16"], - "basic.credentials.exploit_password_list": [ - "Password1!", - "Xk8VDTsC", - "password", - "12345678", - ], - "basic.credentials.exploit_user_list": ["Administrator", "m0nk3y", "user"], - "internal.network.tcp_scanner.HTTP_PORTS": [], - "internal.network.tcp_scanner.tcp_target_ports": [3389], - } - ) diff --git a/envs/monkey_zoo/blackbox/config_templates/single_tests/performance.py b/envs/monkey_zoo/blackbox/config_templates/single_tests/performance.py deleted file mode 100644 index 4c96a9b1e..000000000 --- a/envs/monkey_zoo/blackbox/config_templates/single_tests/performance.py +++ /dev/null @@ -1,60 +0,0 @@ -from envs.monkey_zoo.blackbox.config_templates.config_template import ConfigTemplate - - -class Performance(ConfigTemplate): - config_values = { - "basic.credentials.exploit_password_list": [ - "Xk8VDTsC", - "^NgDvY59~8", - "Ivrrw5zEzs", - "3Q=(Ge(+&w]*", - "`))jU7L(w}", - "t67TC5ZDmz", - ], - "basic.credentials.exploit_user_list": ["m0nk3y"], - "basic.exploiters.exploiter_classes": [ - "SmbExploiter", - "WmiExploiter", - "SSHExploiter", - "HadoopExploiter", - "MSSQLExploiter", - "PowerShellExploiter", - "ZerologonExploiter", - "Log4ShellExploiter", - ], - "basic_network.network_analysis.inaccessible_subnets": [ - "10.2.2.0/30", - "10.2.2.8/30", - "10.2.2.21/32", - "10.2.2.19/32", - "10.2.2.18/32", - "10.2.2.17/32", - ], - "basic_network.scope.subnet_scan_list": [ - "10.2.2.2", - "10.2.2.3", - "10.2.2.4", - "10.2.2.5", - "10.2.2.8", - "10.2.2.9", - "10.2.1.10", - "10.2.0.11", - "10.2.0.12", - "10.2.2.11", - "10.2.2.12", - "10.2.2.14", - "10.2.2.15", - "10.2.2.16", - "10.2.2.18", - "10.2.2.19", - "10.2.2.20", - "10.2.2.21", - "10.2.2.25", - "10.2.3.55", - "10.2.3.56", - "10.2.3.49", - "10.2.3.50", - "10.2.3.51", - "10.2.3.52", - ], - } diff --git a/envs/monkey_zoo/blackbox/config_templates/single_tests/powershell.py b/envs/monkey_zoo/blackbox/config_templates/single_tests/powershell.py deleted file mode 100644 index 3d8bb4d69..000000000 --- a/envs/monkey_zoo/blackbox/config_templates/single_tests/powershell.py +++ /dev/null @@ -1,29 +0,0 @@ -from copy import copy - -from envs.monkey_zoo.blackbox.config_templates.base_template import BaseTemplate -from envs.monkey_zoo.blackbox.config_templates.config_template import ConfigTemplate - - -class PowerShell(ConfigTemplate): - config_values = copy(BaseTemplate.config_values) - - config_values.update( - { - "basic.exploiters.exploiter_classes": ["PowerShellExploiter"], - "basic_network.scope.subnet_scan_list": [ - "10.2.3.45", - "10.2.3.46", - "10.2.3.47", - "10.2.3.48", - ], - "basic.credentials.exploit_password_list": ["Passw0rd!"], - "basic_network.scope.depth": 2, - "basic.credentials.exploit_user_list": ["m0nk3y", "m0nk3y-user"], - "internal.classes.finger_classes": [], - "internal.network.tcp_scanner.HTTP_PORTS": [], - "internal.network.tcp_scanner.tcp_target_ports": [5985, 5986], - "internal.exploits.exploit_ntlm_hash_list": [ - "d0f0132b308a0c4e5d1029cc06f48692", - ], - } - ) diff --git a/envs/monkey_zoo/blackbox/config_templates/single_tests/smb_mimikatz.py b/envs/monkey_zoo/blackbox/config_templates/single_tests/smb_mimikatz.py deleted file mode 100644 index 828d2da21..000000000 --- a/envs/monkey_zoo/blackbox/config_templates/single_tests/smb_mimikatz.py +++ /dev/null @@ -1,23 +0,0 @@ -from copy import copy - -from envs.monkey_zoo.blackbox.config_templates.base_template import BaseTemplate -from envs.monkey_zoo.blackbox.config_templates.config_template import ConfigTemplate - - -class SmbMimikatz(ConfigTemplate): - config_values = copy(BaseTemplate.config_values) - - config_values.update( - { - "basic.exploiters.exploiter_classes": ["SmbExploiter"], - "basic_network.scope.subnet_scan_list": ["10.2.2.14", "10.2.2.15"], - "basic.credentials.exploit_password_list": ["Password1!", "Ivrrw5zEzs"], - "basic.credentials.exploit_user_list": ["Administrator", "m0nk3y", "user"], - "internal.classes.finger_classes": ["SMBFinger", "HTTPFinger"], - "internal.network.tcp_scanner.HTTP_PORTS": [], - "internal.network.tcp_scanner.tcp_target_ports": [445], - "monkey.system_info.system_info_collector_classes": [ - "MimikatzCollector", - ], - } - ) diff --git a/envs/monkey_zoo/blackbox/config_templates/single_tests/ssh.py b/envs/monkey_zoo/blackbox/config_templates/single_tests/ssh.py deleted file mode 100644 index 5a519d5d1..000000000 --- a/envs/monkey_zoo/blackbox/config_templates/single_tests/ssh.py +++ /dev/null @@ -1,21 +0,0 @@ -from copy import copy - -from envs.monkey_zoo.blackbox.config_templates.base_template import BaseTemplate -from envs.monkey_zoo.blackbox.config_templates.config_template import ConfigTemplate - - -class Ssh(ConfigTemplate): - config_values = copy(BaseTemplate.config_values) - - config_values.update( - { - "basic.exploiters.exploiter_classes": ["SSHExploiter"], - "basic_network.scope.subnet_scan_list": ["10.2.2.11", "10.2.2.12"], - "basic.credentials.exploit_password_list": ["Password1!", "12345678", "^NgDvY59~8"], - "basic_network.scope.depth": 2, - "basic.credentials.exploit_user_list": ["Administrator", "m0nk3y", "user"], - "internal.classes.finger_classes": ["SSHFinger"], - "internal.network.tcp_scanner.HTTP_PORTS": [], - "internal.network.tcp_scanner.tcp_target_ports": [22], - } - ) diff --git a/envs/monkey_zoo/blackbox/config_templates/single_tests/tunneling.py b/envs/monkey_zoo/blackbox/config_templates/single_tests/tunneling.py deleted file mode 100644 index ec876b607..000000000 --- a/envs/monkey_zoo/blackbox/config_templates/single_tests/tunneling.py +++ /dev/null @@ -1,35 +0,0 @@ -from copy import copy - -from envs.monkey_zoo.blackbox.config_templates.base_template import BaseTemplate -from envs.monkey_zoo.blackbox.config_templates.config_template import ConfigTemplate - - -class Tunneling(ConfigTemplate): - config_values = copy(BaseTemplate.config_values) - - config_values.update( - { - "basic.exploiters.exploiter_classes": ["SmbExploiter", "WmiExploiter", "SSHExploiter"], - "basic_network.scope.subnet_scan_list": [ - "10.2.2.9", - "10.2.1.10", - "10.2.0.12", - "10.2.0.11", - ], - "basic_network.scope.depth": 3, - "internal.general.keep_tunnel_open_time": 20, - "basic.credentials.exploit_password_list": [ - "Password1!", - "3Q=(Ge(+&w]*", - "`))jU7L(w}", - "t67TC5ZDmz", - "12345678", - ], - "basic.credentials.exploit_user_list": ["Administrator", "m0nk3y", "user"], - "internal.classes.finger_classes": [ - "SSHFinger", - "HTTPFinger", - "SMBFinger", - ], - } - ) diff --git a/envs/monkey_zoo/blackbox/config_templates/single_tests/wmi_pth.py b/envs/monkey_zoo/blackbox/config_templates/single_tests/wmi_pth.py deleted file mode 100644 index ff2078d72..000000000 --- a/envs/monkey_zoo/blackbox/config_templates/single_tests/wmi_pth.py +++ /dev/null @@ -1,24 +0,0 @@ -from copy import copy - -from envs.monkey_zoo.blackbox.config_templates.base_template import BaseTemplate -from envs.monkey_zoo.blackbox.config_templates.config_template import ConfigTemplate - - -class WmiPth(ConfigTemplate): - config_values = copy(BaseTemplate.config_values) - - config_values.update( - { - "basic.exploiters.exploiter_classes": ["WmiExploiter"], - "basic_network.scope.subnet_scan_list": ["10.2.2.15"], - "basic.credentials.exploit_password_list": ["Password1!"], - "basic.credentials.exploit_user_list": ["Administrator", "m0nk3y", "user"], - "internal.classes.finger_classes": ["HTTPFinger"], - "internal.network.tcp_scanner.HTTP_PORTS": [], - "internal.network.tcp_scanner.tcp_target_ports": [135], - "internal.exploits.exploit_ntlm_hash_list": [ - "5da0889ea2081aa79f6852294cba4a5e", - "50c9987a6bf1ac59398df9f911122c9b", - ], - } - ) From cf45ae4c3ea816af3c4abf2157ad573f823adecf Mon Sep 17 00:00:00 2001 From: Mike Salvatore Date: Mon, 18 Jul 2022 13:07:18 -0400 Subject: [PATCH 3/4] BB: Remove "grouped" subpackage --- .../blackbox/config_templates/{grouped => }/depth_1_a.py | 0 .../blackbox/config_templates/{grouped => }/depth_2_a.py | 0 .../blackbox/config_templates/{grouped => }/depth_3_a.py | 0 envs/monkey_zoo/blackbox/test_blackbox.py | 6 +++--- envs/monkey_zoo/blackbox/utils/config_generation_script.py | 6 +++--- 5 files changed, 6 insertions(+), 6 deletions(-) rename envs/monkey_zoo/blackbox/config_templates/{grouped => }/depth_1_a.py (100%) rename envs/monkey_zoo/blackbox/config_templates/{grouped => }/depth_2_a.py (100%) rename envs/monkey_zoo/blackbox/config_templates/{grouped => }/depth_3_a.py (100%) diff --git a/envs/monkey_zoo/blackbox/config_templates/grouped/depth_1_a.py b/envs/monkey_zoo/blackbox/config_templates/depth_1_a.py similarity index 100% rename from envs/monkey_zoo/blackbox/config_templates/grouped/depth_1_a.py rename to envs/monkey_zoo/blackbox/config_templates/depth_1_a.py diff --git a/envs/monkey_zoo/blackbox/config_templates/grouped/depth_2_a.py b/envs/monkey_zoo/blackbox/config_templates/depth_2_a.py similarity index 100% rename from envs/monkey_zoo/blackbox/config_templates/grouped/depth_2_a.py rename to envs/monkey_zoo/blackbox/config_templates/depth_2_a.py diff --git a/envs/monkey_zoo/blackbox/config_templates/grouped/depth_3_a.py b/envs/monkey_zoo/blackbox/config_templates/depth_3_a.py similarity index 100% rename from envs/monkey_zoo/blackbox/config_templates/grouped/depth_3_a.py rename to envs/monkey_zoo/blackbox/config_templates/depth_3_a.py diff --git a/envs/monkey_zoo/blackbox/test_blackbox.py b/envs/monkey_zoo/blackbox/test_blackbox.py index b447e0606..081f3c4fa 100644 --- a/envs/monkey_zoo/blackbox/test_blackbox.py +++ b/envs/monkey_zoo/blackbox/test_blackbox.py @@ -8,9 +8,9 @@ from typing_extensions import Type 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.config_templates.config_template import ConfigTemplate -from envs.monkey_zoo.blackbox.config_templates.grouped.depth_1_a import Depth1A -from envs.monkey_zoo.blackbox.config_templates.grouped.depth_2_a import Depth2A -from envs.monkey_zoo.blackbox.config_templates.grouped.depth_3_a import Depth3A +from envs.monkey_zoo.blackbox.config_templates.depth_1_a import Depth1A +from envs.monkey_zoo.blackbox.config_templates.depth_2_a import Depth2A +from envs.monkey_zoo.blackbox.config_templates.depth_3_a import Depth3A from envs.monkey_zoo.blackbox.config_templates.single_tests.powershell_credentials_reuse import ( PowerShellCredentialsReuse, ) diff --git a/envs/monkey_zoo/blackbox/utils/config_generation_script.py b/envs/monkey_zoo/blackbox/utils/config_generation_script.py index 3a5f06c50..218ea2870 100644 --- a/envs/monkey_zoo/blackbox/utils/config_generation_script.py +++ b/envs/monkey_zoo/blackbox/utils/config_generation_script.py @@ -3,9 +3,9 @@ import pathlib from typing import Type from envs.monkey_zoo.blackbox.config_templates.config_template import ConfigTemplate -from envs.monkey_zoo.blackbox.config_templates.grouped.depth_1_a import Depth1A -from envs.monkey_zoo.blackbox.config_templates.grouped.depth_2_a import Depth2A -from envs.monkey_zoo.blackbox.config_templates.grouped.depth_3_a import Depth3A +from envs.monkey_zoo.blackbox.config_templates.depth_1_a import Depth1A +from envs.monkey_zoo.blackbox.config_templates.depth_2_a import Depth2A +from envs.monkey_zoo.blackbox.config_templates.depth_3_a import Depth3A from envs.monkey_zoo.blackbox.config_templates.single_tests.powershell_credentials_reuse import ( PowerShellCredentialsReuse, ) From ea1dc930a13969271cce65b2d0f2029b872ea24f Mon Sep 17 00:00:00 2001 From: Mike Salvatore Date: Mon, 18 Jul 2022 13:08:29 -0400 Subject: [PATCH 4/4] BB: Remove "single_tests" subpackage --- .../{single_tests => }/powershell_credentials_reuse.py | 0 .../config_templates/{single_tests => }/smb_pth.py | 0 .../config_templates/{single_tests => }/wmi_mimikatz.py | 0 .../config_templates/{single_tests => }/zerologon.py | 0 envs/monkey_zoo/blackbox/test_blackbox.py | 8 ++++---- .../monkey_zoo/blackbox/utils/config_generation_script.py | 8 ++++---- 6 files changed, 8 insertions(+), 8 deletions(-) rename envs/monkey_zoo/blackbox/config_templates/{single_tests => }/powershell_credentials_reuse.py (100%) rename envs/monkey_zoo/blackbox/config_templates/{single_tests => }/smb_pth.py (100%) rename envs/monkey_zoo/blackbox/config_templates/{single_tests => }/wmi_mimikatz.py (100%) rename envs/monkey_zoo/blackbox/config_templates/{single_tests => }/zerologon.py (100%) diff --git a/envs/monkey_zoo/blackbox/config_templates/single_tests/powershell_credentials_reuse.py b/envs/monkey_zoo/blackbox/config_templates/powershell_credentials_reuse.py similarity index 100% rename from envs/monkey_zoo/blackbox/config_templates/single_tests/powershell_credentials_reuse.py rename to envs/monkey_zoo/blackbox/config_templates/powershell_credentials_reuse.py diff --git a/envs/monkey_zoo/blackbox/config_templates/single_tests/smb_pth.py b/envs/monkey_zoo/blackbox/config_templates/smb_pth.py similarity index 100% rename from envs/monkey_zoo/blackbox/config_templates/single_tests/smb_pth.py rename to envs/monkey_zoo/blackbox/config_templates/smb_pth.py diff --git a/envs/monkey_zoo/blackbox/config_templates/single_tests/wmi_mimikatz.py b/envs/monkey_zoo/blackbox/config_templates/wmi_mimikatz.py similarity index 100% rename from envs/monkey_zoo/blackbox/config_templates/single_tests/wmi_mimikatz.py rename to envs/monkey_zoo/blackbox/config_templates/wmi_mimikatz.py diff --git a/envs/monkey_zoo/blackbox/config_templates/single_tests/zerologon.py b/envs/monkey_zoo/blackbox/config_templates/zerologon.py similarity index 100% rename from envs/monkey_zoo/blackbox/config_templates/single_tests/zerologon.py rename to envs/monkey_zoo/blackbox/config_templates/zerologon.py diff --git a/envs/monkey_zoo/blackbox/test_blackbox.py b/envs/monkey_zoo/blackbox/test_blackbox.py index 081f3c4fa..6cafe1264 100644 --- a/envs/monkey_zoo/blackbox/test_blackbox.py +++ b/envs/monkey_zoo/blackbox/test_blackbox.py @@ -11,12 +11,12 @@ from envs.monkey_zoo.blackbox.config_templates.config_template import ConfigTemp from envs.monkey_zoo.blackbox.config_templates.depth_1_a import Depth1A from envs.monkey_zoo.blackbox.config_templates.depth_2_a import Depth2A from envs.monkey_zoo.blackbox.config_templates.depth_3_a import Depth3A -from envs.monkey_zoo.blackbox.config_templates.single_tests.powershell_credentials_reuse import ( +from envs.monkey_zoo.blackbox.config_templates.powershell_credentials_reuse import ( PowerShellCredentialsReuse, ) -from envs.monkey_zoo.blackbox.config_templates.single_tests.smb_pth import SmbPth -from envs.monkey_zoo.blackbox.config_templates.single_tests.wmi_mimikatz import WmiMimikatz -from envs.monkey_zoo.blackbox.config_templates.single_tests.zerologon import Zerologon +from envs.monkey_zoo.blackbox.config_templates.smb_pth import SmbPth +from envs.monkey_zoo.blackbox.config_templates.wmi_mimikatz import WmiMimikatz +from envs.monkey_zoo.blackbox.config_templates.zerologon import Zerologon 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 diff --git a/envs/monkey_zoo/blackbox/utils/config_generation_script.py b/envs/monkey_zoo/blackbox/utils/config_generation_script.py index 218ea2870..f3d20d414 100644 --- a/envs/monkey_zoo/blackbox/utils/config_generation_script.py +++ b/envs/monkey_zoo/blackbox/utils/config_generation_script.py @@ -6,12 +6,12 @@ from envs.monkey_zoo.blackbox.config_templates.config_template import ConfigTemp from envs.monkey_zoo.blackbox.config_templates.depth_1_a import Depth1A from envs.monkey_zoo.blackbox.config_templates.depth_2_a import Depth2A from envs.monkey_zoo.blackbox.config_templates.depth_3_a import Depth3A -from envs.monkey_zoo.blackbox.config_templates.single_tests.powershell_credentials_reuse import ( +from envs.monkey_zoo.blackbox.config_templates.powershell_credentials_reuse import ( PowerShellCredentialsReuse, ) -from envs.monkey_zoo.blackbox.config_templates.single_tests.smb_pth import SmbPth -from envs.monkey_zoo.blackbox.config_templates.single_tests.wmi_mimikatz import WmiMimikatz -from envs.monkey_zoo.blackbox.config_templates.single_tests.zerologon import Zerologon +from envs.monkey_zoo.blackbox.config_templates.smb_pth import SmbPth +from envs.monkey_zoo.blackbox.config_templates.wmi_mimikatz import WmiMimikatz +from envs.monkey_zoo.blackbox.config_templates.zerologon import Zerologon from envs.monkey_zoo.blackbox.island_client.island_config_parser import IslandConfigParser from envs.monkey_zoo.blackbox.island_client.monkey_island_client import MonkeyIslandClient