island: Rename RunLocalMonkeyService -> LocalMonkeyRunService

This commit is contained in:
Mike Salvatore 2021-05-12 12:09:46 -04:00
parent 79eb7442ae
commit b8d4452e70
3 changed files with 7 additions and 7 deletions

View File

@ -6,7 +6,7 @@ from flask import jsonify, make_response, request
from monkey_island.cc.models import Monkey
from monkey_island.cc.resources.auth.auth import jwt_required
from monkey_island.cc.services.node import NodeService
from monkey_island.cc.services.run_local_monkey import RunLocalMonkeyService
from monkey_island.cc.services.run_local_monkey import LocalMonkeyRunService
class LocalRun(flask_restful.Resource):
@ -25,7 +25,7 @@ class LocalRun(flask_restful.Resource):
def post(self):
body = json.loads(request.data)
if body.get("action") == "run":
local_run = RunLocalMonkeyService.run_local_monkey()
local_run = LocalMonkeyRunService.run_local_monkey()
return jsonify(is_running=local_run[0], error_text=local_run[1])
# default action

View File

@ -1,7 +1,7 @@
from monkey_island.cc.services.post_breach_files import PostBreachFilesService
from monkey_island.cc.services.run_local_monkey import RunLocalMonkeyService
from monkey_island.cc.services.run_local_monkey import LocalMonkeyRunService
def initialize_services(data_dir):
PostBreachFilesService.initialize(data_dir)
RunLocalMonkeyService.initialize(data_dir)
LocalMonkeyRunService.initialize(data_dir)

View File

@ -13,7 +13,7 @@ from monkey_island.cc.services.utils.network_utils import local_ip_addresses
logger = logging.getLogger(__name__)
class RunLocalMonkeyService:
class LocalMonkeyRunService:
DATA_DIR = None
# TODO: A number of these services should be instance objects instead of
@ -31,7 +31,7 @@ class RunLocalMonkeyService:
return False, "OS Type not found"
src_path = os.path.join(MONKEY_ISLAND_ABS_PATH, "cc", "binaries", result["filename"])
dest_path = os.path.join(RunLocalMonkeyService.DATA_DIR, result["filename"])
dest_path = os.path.join(LocalMonkeyRunService.DATA_DIR, result["filename"])
# copy the executable to temp path (don't run the monkey from its current location as it may
# delete itself)
@ -48,7 +48,7 @@ class RunLocalMonkeyService:
port = env_singleton.env.get_island_port()
args = [dest_path, "m0nk3y", "-s", f"{ip}:{port}"]
subprocess.Popen(args, cwd=RunLocalMonkeyService.DATA_DIR)
subprocess.Popen(args, cwd=LocalMonkeyRunService.DATA_DIR)
except Exception as exc:
logger.error("popen failed", exc_info=True)
return False, "popen failed: %s" % exc