From 3aad64dff7c4a42c36a29faa4a39f2e14d89b280 Mon Sep 17 00:00:00 2001 From: Ilija Lazoroski Date: Mon, 22 Nov 2021 19:58:49 +0100 Subject: [PATCH] Island: Add endpoint to retrive propagation credentials --- monkey/monkey_island/cc/app.py | 2 ++ .../cc/resources/propagation_credentials.py | 9 +++++++++ monkey/monkey_island/cc/services/config.py | 16 ++++++++++++++++ 3 files changed, 27 insertions(+) create mode 100644 monkey/monkey_island/cc/resources/propagation_credentials.py diff --git a/monkey/monkey_island/cc/app.py b/monkey/monkey_island/cc/app.py index 113c20d06..a45800b9f 100644 --- a/monkey/monkey_island/cc/app.py +++ b/monkey/monkey_island/cc/app.py @@ -40,6 +40,7 @@ from monkey_island.cc.resources.node import Node from monkey_island.cc.resources.node_states import NodeStates from monkey_island.cc.resources.pba_file_download import PBAFileDownload from monkey_island.cc.resources.pba_file_upload import FileUpload +from monkey_island.cc.resources.propagation_credentials import PropagationCredentials from monkey_island.cc.resources.ransomware_report import RansomwareReport from monkey_island.cc.resources.remote_run import RemoteRun from monkey_island.cc.resources.root import Root @@ -165,6 +166,7 @@ def init_api_resources(api): "/api/fileUpload/?load=", "/api/fileUpload/?restore=", ) + api.add_resource(PropagationCredentials, "/api/propagationCredentials") api.add_resource(RemoteRun, "/api/remote-monkey", "/api/remote-monkey/") api.add_resource(VersionUpdate, "/api/version-update", "/api/version-update/") api.add_resource(RemotePortCheck, "/api/monkey_control/check_remote_port/") diff --git a/monkey/monkey_island/cc/resources/propagation_credentials.py b/monkey/monkey_island/cc/resources/propagation_credentials.py new file mode 100644 index 000000000..16699300e --- /dev/null +++ b/monkey/monkey_island/cc/resources/propagation_credentials.py @@ -0,0 +1,9 @@ +import flask_restful + +from monkey_island.cc.services.config import ConfigService + + +class PropagationCredentials(flask_restful.Resource): + def get(self): + + return {'propagation_credentials': ConfigService.get_config_propagation_credentials()} diff --git a/monkey/monkey_island/cc/services/config.py b/monkey/monkey_island/cc/services/config.py index 0214a957e..4be546c57 100644 --- a/monkey/monkey_island/cc/services/config.py +++ b/monkey/monkey_island/cc/services/config.py @@ -407,3 +407,19 @@ class ConfigService: @staticmethod def set_started_on_island(value: bool): ConfigService.set_config_value(STARTED_ON_ISLAND_PATH, value) + + @staticmethod + def get_config_propagation_credentials(): + return { + "exploit_user_list": ConfigService.get_config_value(USER_LIST_PATH, should_decrypt=False), + "exploit_password_list": ConfigService.get_config_value( + PASSWORD_LIST_PATH, should_decrypt=False + ), + "exploit_lm_hash_list": ConfigService.get_config_value( + LM_HASH_LIST_PATH, should_decrypt=False + ), + "exploit_ntlm_hash_list": ConfigService.get_config_value( + NTLM_HASH_LIST_PATH, should_decrypt=False + ), + "exploit_ssh_keys": ConfigService.get_config_value(SSH_KEYS_PATH, should_decrypt=False), + }