forked from p34709852/monkey
Various required fixes
This commit is contained in:
parent
d30f2cf8dc
commit
8a56144a09
|
@ -11,7 +11,7 @@ import traceback
|
|||
from config import WormConfiguration, EXTERNAL_CONFIG_FILE
|
||||
from dropper import MonkeyDrops
|
||||
from model import MONKEY_ARG, DROPPER_ARG
|
||||
from monkey import InfectionMonkey
|
||||
from infection_monkey.monkey import InfectionMonkey
|
||||
import utils
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
|
@ -4,7 +4,7 @@ from datetime import datetime
|
|||
import bson
|
||||
import flask_restful
|
||||
from bson.json_util import dumps
|
||||
from flask import Flask, send_from_directory, make_response
|
||||
from flask import Flask, send_from_directory, make_response, Response
|
||||
from werkzeug.exceptions import NotFound
|
||||
|
||||
from cc.auth import init_jwt
|
||||
|
@ -28,18 +28,23 @@ from cc.services.config import ConfigService
|
|||
__author__ = 'Barak'
|
||||
|
||||
|
||||
HOME_FILE = 'index.html'
|
||||
|
||||
|
||||
def serve_static_file(static_path):
|
||||
if static_path.startswith('api/'):
|
||||
raise NotFound()
|
||||
try:
|
||||
return send_from_directory('ui/dist', static_path)
|
||||
return send_from_directory(os.path.join(os.getcwd(), 'monkey_island/cc/ui/dist'), static_path)
|
||||
except NotFound:
|
||||
# Because react uses various urls for same index page, this is probably the user's intention.
|
||||
if static_path == HOME_FILE:
|
||||
flask_restful.abort(Response("Server cwd isn't right, should be monkey\\monkey.", 500))
|
||||
return serve_home()
|
||||
|
||||
|
||||
def serve_home():
|
||||
return serve_static_file('index.html')
|
||||
return serve_static_file(HOME_FILE)
|
||||
|
||||
|
||||
def normalize_obj(obj):
|
||||
|
|
|
@ -24,8 +24,8 @@ def run_local_monkey():
|
|||
if not result:
|
||||
return False, "OS Type not found"
|
||||
|
||||
monkey_path = os.path.join('binaries', result['filename'])
|
||||
target_path = os.path.join(os.getcwd(), result['filename'])
|
||||
monkey_path = os.path.join(os.getcwd(), 'monkey_island', 'cc', 'binaries', result['filename'])
|
||||
target_path = os.path.join(os.getcwd(), 'monkey_island', result['filename'])
|
||||
|
||||
# copy the executable to temp path (don't run the monkey from its current location as it may delete itself)
|
||||
try:
|
||||
|
|
Loading…
Reference in New Issue