island: Use `create_secure_directory()` for custom PBA directory creation

This commit is contained in:
Shreya 2021-06-28 11:56:40 +05:30
parent 33a6e72df5
commit 75a2f1b12e
1 changed files with 4 additions and 2 deletions

View File

@ -1,6 +1,7 @@
import logging import logging
import os import os
from pathlib import Path
from monkey_island.cc.server_utils.file_utils import create_secure_directory
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@ -15,7 +16,8 @@ class PostBreachFilesService:
@classmethod @classmethod
def initialize(cls, data_dir): def initialize(cls, data_dir):
cls.DATA_DIR = 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 @staticmethod
def save_file(filename: str, file_contents: bytes): def save_file(filename: str, file_contents: bytes):