From 1d45a15ea15bfa7692c239da5f1ec655e97a28b3 Mon Sep 17 00:00:00 2001 From: Shreya Malviya Date: Thu, 21 Jul 2022 13:29:16 +0530 Subject: [PATCH] BB: Remove config_generation_script.py --- .../utils/config_generation_script.py | 59 ------------------- 1 file changed, 59 deletions(-) delete mode 100644 envs/monkey_zoo/blackbox/utils/config_generation_script.py diff --git a/envs/monkey_zoo/blackbox/utils/config_generation_script.py b/envs/monkey_zoo/blackbox/utils/config_generation_script.py deleted file mode 100644 index f3d20d414..000000000 --- a/envs/monkey_zoo/blackbox/utils/config_generation_script.py +++ /dev/null @@ -1,59 +0,0 @@ -import argparse -import pathlib -from typing import Type - -from envs.monkey_zoo.blackbox.config_templates.config_template import ConfigTemplate -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.powershell_credentials_reuse import ( - PowerShellCredentialsReuse, -) -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 - -DST_DIR_NAME = "generated_configs" -DST_DIR_PATH = pathlib.Path(pathlib.Path(__file__).parent.absolute(), DST_DIR_NAME) - -parser = argparse.ArgumentParser(description="Generate config files.") -parser.add_argument( - "island_ip", - metavar="IP:PORT", - help="Island endpoint. Example: 123.123.123.123:5000", -) - -args = parser.parse_args() -island_client = MonkeyIslandClient(args.island_ip) - -CONFIG_TEMPLATES = [ - Depth1A, - Depth2A, - Depth3A, - Zerologon, - SmbPth, - WmiMimikatz, - PowerShellCredentialsReuse, -] - - -def generate_templates(): - for template in CONFIG_TEMPLATES: - save_template_as_config(template) - - -def save_template_as_config(template: Type[ConfigTemplate]): - file_path = pathlib.Path(DST_DIR_PATH, f"{template.__name__}.conf") - file_contents = IslandConfigParser.get_raw_config(template, island_client) - save_to_file(file_path, file_contents) - - -def save_to_file(file_path, contents): - with open(file_path, "w") as file: - file.write(contents) - - -if __name__ == "__main__": - generate_templates()