Fixed post breach file upload bug
This commit is contained in:
parent
62c4eeb3fc
commit
628583d38f
|
@ -9,7 +9,7 @@ from werkzeug.utils import secure_filename
|
|||
from monkey_island.cc.resources.auth.auth import jwt_required
|
||||
from monkey_island.cc.services.config import ConfigService
|
||||
from monkey_island.cc.services.post_breach_files import (
|
||||
PBA_LINUX_FILENAME_PATH, PBA_WINDOWS_FILENAME_PATH, UPLOADS_DIR)
|
||||
PBA_LINUX_FILENAME_PATH, PBA_WINDOWS_FILENAME_PATH, PBA_UPLOAD_PATH, UPLOADS_DIR)
|
||||
|
||||
__author__ = 'VakarisZ'
|
||||
|
||||
|
@ -18,6 +18,9 @@ LOG = logging.getLogger(__name__)
|
|||
LINUX_PBA_TYPE = 'PBAlinux'
|
||||
WINDOWS_PBA_TYPE = 'PBAwindows'
|
||||
|
||||
# This path is used by flask, which means that local directory is different from UPLOADS_DIR
|
||||
FLASK_UPLOAD_PATH = PBA_UPLOAD_PATH[-1]
|
||||
|
||||
|
||||
class FileUpload(flask_restful.Resource):
|
||||
"""
|
||||
|
@ -39,7 +42,7 @@ class FileUpload(flask_restful.Resource):
|
|||
filename = ConfigService.get_config_value(copy.deepcopy(PBA_LINUX_FILENAME_PATH))
|
||||
else:
|
||||
filename = ConfigService.get_config_value(copy.deepcopy(PBA_WINDOWS_FILENAME_PATH))
|
||||
return send_from_directory(UPLOADS_DIR, filename)
|
||||
return send_from_directory(FLASK_UPLOAD_PATH, filename)
|
||||
|
||||
@jwt_required
|
||||
def post(self, file_type):
|
||||
|
|
|
@ -11,7 +11,8 @@ logger = logging.getLogger(__name__)
|
|||
# Where to find file names in config
|
||||
PBA_WINDOWS_FILENAME_PATH = ['monkey', 'post_breach', 'PBA_windows_filename']
|
||||
PBA_LINUX_FILENAME_PATH = ['monkey', 'post_breach', 'PBA_linux_filename']
|
||||
UPLOADS_DIR = Path('monkey_island', 'cc', 'userUploads')
|
||||
PBA_UPLOAD_PATH = ['monkey_island', 'cc', 'userUploads']
|
||||
UPLOADS_DIR = Path(*PBA_UPLOAD_PATH)
|
||||
|
||||
|
||||
def remove_PBA_files():
|
||||
|
|
Loading…
Reference in New Issue