Agent: Add agent GUID to /api/propagation-credentials call

This commit is contained in:
Mike Salvatore 2021-12-07 11:29:52 -05:00
parent 8ecf328b4c
commit 0783e236aa
3 changed files with 9 additions and 7 deletions

View File

@ -56,7 +56,7 @@ class ControlChannel(IControlChannel):
def get_credentials_for_propagation(self) -> dict:
try:
response = requests.get( # noqa: DUO123
f"{self._control_channel_server}/api/propagation-credentials",
f"{self._control_channel_server}/api/propagation-credentials/{self._agent_id}",
verify=False,
proxies=ControlClient.proxies,
timeout=SHORT_REQUEST_TIMEOUT,
@ -67,3 +67,5 @@ class ControlChannel(IControlChannel):
except Exception as e:
# TODO: Evaluate how this exception is handled; don't just log and ignore it.
logger.error(f"An error occurred while trying to connect to server. {e}")
return {}

View File

@ -7,7 +7,7 @@ from monkey_island.cc.services.config import ConfigService
class PropagationCredentials(flask_restful.Resource):
def get(self, guid: str):
monkey_json = mongo.db.monkey.find_one_or_404({"guid": guid})
ConfigService.decrypt_flat_config(monkey_json)
ConfigService.decrypt_flat_config(monkey_json["config"])
propagation_credentials = ConfigService.get_config_propagation_credentials_from_flat_config(
monkey_json["config"]

View File

@ -412,11 +412,11 @@ class ConfigService:
@staticmethod
def get_config_propagation_credentials_from_flat_config(config):
return {
"exploit_user_list": config["exploit_user_list"],
"exploit_password_list": config["exploit_password_list"],
"exploit_lm_hash_list": config["exploit_lm_hash_list"],
"exploit_ntlm_hash_list": config["exploit_ntlm_hash_list"],
"exploit_ssh_keys": config["exploit_ssh_keys"],
"exploit_user_list": config.get("exploit_user_list", []),
"exploit_password_list": config.get("exploit_password_list", []),
"exploit_lm_hash_list": config.get("exploit_lm_hash_list", []),
"exploit_ntlm_hash_list": config.get("exploit_ntlm_hash_list", []),
"exploit_ssh_keys": config.get("exploit_ssh_keys", []),
}
@staticmethod