From 75a2f1b12eb6cb7a4651d0e92d7e77b49cf51b2b Mon Sep 17 00:00:00 2001 From: Shreya Date: Mon, 28 Jun 2021 11:56:40 +0530 Subject: [PATCH] island: Use `create_secure_directory()` for custom PBA directory creation --- monkey/monkey_island/cc/services/post_breach_files.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/monkey/monkey_island/cc/services/post_breach_files.py b/monkey/monkey_island/cc/services/post_breach_files.py index 94569db37..8268265a9 100644 --- a/monkey/monkey_island/cc/services/post_breach_files.py +++ b/monkey/monkey_island/cc/services/post_breach_files.py @@ -1,6 +1,7 @@ import logging import os -from pathlib import Path + +from monkey_island.cc.server_utils.file_utils import create_secure_directory logger = logging.getLogger(__name__) @@ -15,7 +16,8 @@ class PostBreachFilesService: @classmethod def initialize(cls, data_dir): cls.DATA_DIR = data_dir - Path(cls.get_custom_pba_directory()).mkdir(mode=0o0700, parents=True, exist_ok=True) + custom_pba_dir = cls.get_custom_pba_directory() + create_secure_directory(custom_pba_dir) @staticmethod def save_file(filename: str, file_contents: bytes):