From be0f7ac88134db1020d487f6a7fe381b0f2d2ee6 Mon Sep 17 00:00:00 2001 From: Mike Salvatore Date: Tue, 11 May 2021 08:33:56 -0400 Subject: [PATCH] island: Decouple PBAFileDownload from environment_singleton --- monkey/monkey_island/cc/app.py | 2 +- monkey/monkey_island/cc/resources/pba_file_download.py | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/monkey/monkey_island/cc/app.py b/monkey/monkey_island/cc/app.py index a41b26e9a..269b9a5d3 100644 --- a/monkey/monkey_island/cc/app.py +++ b/monkey/monkey_island/cc/app.py @@ -155,7 +155,7 @@ def init_api_resources(api, data_dir): api.add_resource(TelemetryFeed, "/api/telemetry-feed", "/api/telemetry-feed/") api.add_resource(Log, "/api/log", "/api/log/") api.add_resource(IslandLog, "/api/log/island/download", "/api/log/island/download/") - api.add_resource(PBAFileDownload, "/api/pba/download/") + api.add_resource(PBAFileDownload, "/api/pba/download/") api.add_resource(T1216PBAFileDownload, T1216_PBA_FILE_DOWNLOAD_PATH) api.add_resource( FileUpload, diff --git a/monkey/monkey_island/cc/resources/pba_file_download.py b/monkey/monkey_island/cc/resources/pba_file_download.py index 4bb409eec..ec2abecfe 100644 --- a/monkey/monkey_island/cc/resources/pba_file_download.py +++ b/monkey/monkey_island/cc/resources/pba_file_download.py @@ -1,7 +1,7 @@ import flask_restful from flask import send_from_directory -import monkey_island.cc.environment.environment_singleton as env_singleton +from monkey_island.cc.services.post_breach_files import PostBreachFilesService __author__ = "VakarisZ" @@ -12,5 +12,6 @@ class PBAFileDownload(flask_restful.Resource): """ # Used by monkey. can't secure. - def get(self, path): - return send_from_directory(env_singleton.env.get_config().data_dir_abs_path, path) + def get(self, filename): + custom_pba_dir = PostBreachFilesService.get_custom_pba_directory() + return send_from_directory(custom_pba_dir, filename)