island: Decouple PBAFileDownload from environment_singleton

This commit is contained in:
Mike Salvatore 2021-05-11 08:33:56 -04:00
parent 4190797ca2
commit be0f7ac881
2 changed files with 5 additions and 4 deletions

View File

@ -155,7 +155,7 @@ def init_api_resources(api, data_dir):
api.add_resource(TelemetryFeed, "/api/telemetry-feed", "/api/telemetry-feed/") api.add_resource(TelemetryFeed, "/api/telemetry-feed", "/api/telemetry-feed/")
api.add_resource(Log, "/api/log", "/api/log/") api.add_resource(Log, "/api/log", "/api/log/")
api.add_resource(IslandLog, "/api/log/island/download", "/api/log/island/download/") api.add_resource(IslandLog, "/api/log/island/download", "/api/log/island/download/")
api.add_resource(PBAFileDownload, "/api/pba/download/<string:path>") api.add_resource(PBAFileDownload, "/api/pba/download/<string:filename>")
api.add_resource(T1216PBAFileDownload, T1216_PBA_FILE_DOWNLOAD_PATH) api.add_resource(T1216PBAFileDownload, T1216_PBA_FILE_DOWNLOAD_PATH)
api.add_resource( api.add_resource(
FileUpload, FileUpload,

View File

@ -1,7 +1,7 @@
import flask_restful import flask_restful
from flask import send_from_directory 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" __author__ = "VakarisZ"
@ -12,5 +12,6 @@ class PBAFileDownload(flask_restful.Resource):
""" """
# Used by monkey. can't secure. # Used by monkey. can't secure.
def get(self, path): def get(self, filename):
return send_from_directory(env_singleton.env.get_config().data_dir_abs_path, path) custom_pba_dir = PostBreachFilesService.get_custom_pba_directory()
return send_from_directory(custom_pba_dir, filename)