diff --git a/monkey/monkey_island/cc/services/post_breach_files.py b/monkey/monkey_island/cc/services/post_breach_files.py index 1224f6759..d0c1b6a56 100644 --- a/monkey/monkey_island/cc/services/post_breach_files.py +++ b/monkey/monkey_island/cc/services/post_breach_files.py @@ -14,6 +14,7 @@ PBA_LINUX_FILENAME_PATH = ["monkey", "post_breach", "PBA_linux_filename"] class PostBreachFilesService: DATA_DIR = None + CUSTOM_PBA_DIRNAME = "custom_pbas" @staticmethod def remove_PBA_files(): @@ -31,13 +32,19 @@ class PostBreachFilesService: @staticmethod def _remove_file(file_name): - file_path = os.path.join(PostBreachFilesService.DATA_DIR, file_name) + file_path = os.path.join(PostBreachFilesService.get_custom_pba_directory(), file_name) try: if os.path.exists(file_path): os.remove(file_path) except OSError as e: logger.error("Can't remove previously uploaded post breach files: %s" % e) + @staticmethod + def get_custom_pba_directory(): + return os.path.join( + PostBreachFilesService.DATA_DIR, PostBreachFilesService.CUSTOM_PBA_DIRNAME + ) + @staticmethod def set_config_PBA_files(config_json): """