From c8bf47895781ef244534acbab885c5393befcfcf Mon Sep 17 00:00:00 2001 From: D3vil0p3r Date: Tue, 12 Nov 2024 00:55:09 +0100 Subject: [PATCH] Fix logs permission --- empire/client/client.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/empire/client/client.py b/empire/client/client.py index 2ec29b714..79bcf80db 100644 --- a/empire/client/client.py +++ b/empire/client/client.py @@ -467,7 +467,15 @@ def setup_logging(args): logging_dir = empire_config.yaml["logging"]["directory"] log_dir = Path(logging_dir) - log_dir.mkdir(parents=True, exist_ok=True) + + try: + log_dir.mkdir(parents=True, exist_ok=True) + except PermissionError: + user_home = Path.home() + log_dir = user_home / ".empire" / "client" / "downloads" / "logs" + log.debug(f"Permission denied to create logs in the directory specified in the configuration file. Logs will be stored in {log_dir}") + log_dir.mkdir(parents=True, exist_ok=True) + root_log_file = log_dir / "empire_client.log" root_logger = logging.getLogger()