From 1fad6b4666c40792b54eda7841c438786e0f195f Mon Sep 17 00:00:00 2001 From: Mike Salvatore Date: Tue, 16 Feb 2021 15:12:57 -0500 Subject: [PATCH] cc: remove unnecessary `config` property from environment_singleton Introduced in b0d478473fe --- monkey/monkey_island/cc/environment/environment_singleton.py | 3 --- monkey/monkey_island/cc/main.py | 2 +- monkey/monkey_island/cc/resources/local_run.py | 2 +- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/monkey/monkey_island/cc/environment/environment_singleton.py b/monkey/monkey_island/cc/environment/environment_singleton.py index aa2dc32d6..01e83096d 100644 --- a/monkey/monkey_island/cc/environment/environment_singleton.py +++ b/monkey/monkey_island/cc/environment/environment_singleton.py @@ -20,7 +20,6 @@ ENV_DICT = { } env = None -config = None def set_env(env_type: str, env_config: EnvironmentConfig): @@ -40,8 +39,6 @@ def set_to_standard(): def initialize_from_file(file_path): - global config - try: config = EnvironmentConfig(file_path) diff --git a/monkey/monkey_island/cc/main.py b/monkey/monkey_island/cc/main.py index 303f5997d..211084565 100644 --- a/monkey/monkey_island/cc/main.py +++ b/monkey/monkey_island/cc/main.py @@ -35,7 +35,7 @@ MINIMUM_MONGO_DB_VERSION_REQUIRED = "4.2.0" def main(should_setup_only=False, server_config_filename=DEFAULT_SERVER_CONFIG_PATH): logger.info("Starting bootloader server") env_singleton.initialize_from_file(server_config_filename) - initialize_encryptor(env_singleton.config.data_dir_abs_path) + initialize_encryptor(env_singleton.env.get_config().data_dir_abs_path) mongo_url = os.environ.get('MONGO_URL', env_singleton.env.get_mongo_url()) bootloader_server_thread = Thread(target=BootloaderHttpServer(mongo_url).serve_forever, daemon=True) diff --git a/monkey/monkey_island/cc/resources/local_run.py b/monkey/monkey_island/cc/resources/local_run.py index f76548a9a..0758d40c2 100644 --- a/monkey/monkey_island/cc/resources/local_run.py +++ b/monkey/monkey_island/cc/resources/local_run.py @@ -32,7 +32,7 @@ def run_local_monkey(): return False, "OS Type not found" monkey_path = os.path.join(MONKEY_ISLAND_ABS_PATH, 'cc', 'binaries', result['filename']) - target_path = os.path.join(env_singleton.config.data_dir_abs_path, result['filename']) + target_path = os.path.join(env_singleton.env.get_config().data_dir_abs_path, result['filename']) # copy the executable to temp path (don't run the monkey from its current location as it may delete itself) try: