forked from p15670423/monkey
island: Add PostBreachFilesService.get_custom_pba_directory()
This commit is contained in:
parent
ee19eed596
commit
4190797ca2
|
@ -14,6 +14,7 @@ PBA_LINUX_FILENAME_PATH = ["monkey", "post_breach", "PBA_linux_filename"]
|
||||||
|
|
||||||
class PostBreachFilesService:
|
class PostBreachFilesService:
|
||||||
DATA_DIR = None
|
DATA_DIR = None
|
||||||
|
CUSTOM_PBA_DIRNAME = "custom_pbas"
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def remove_PBA_files():
|
def remove_PBA_files():
|
||||||
|
@ -31,13 +32,19 @@ class PostBreachFilesService:
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _remove_file(file_name):
|
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:
|
try:
|
||||||
if os.path.exists(file_path):
|
if os.path.exists(file_path):
|
||||||
os.remove(file_path)
|
os.remove(file_path)
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
logger.error("Can't remove previously uploaded post breach files: %s" % 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
|
@staticmethod
|
||||||
def set_config_PBA_files(config_json):
|
def set_config_PBA_files(config_json):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in New Issue