forked from p15670423/monkey
Agent: Add agent GUID to /api/propagation-credentials call
This commit is contained in:
parent
8ecf328b4c
commit
0783e236aa
|
@ -56,7 +56,7 @@ class ControlChannel(IControlChannel):
|
||||||
def get_credentials_for_propagation(self) -> dict:
|
def get_credentials_for_propagation(self) -> dict:
|
||||||
try:
|
try:
|
||||||
response = requests.get( # noqa: DUO123
|
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,
|
verify=False,
|
||||||
proxies=ControlClient.proxies,
|
proxies=ControlClient.proxies,
|
||||||
timeout=SHORT_REQUEST_TIMEOUT,
|
timeout=SHORT_REQUEST_TIMEOUT,
|
||||||
|
@ -67,3 +67,5 @@ class ControlChannel(IControlChannel):
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
# TODO: Evaluate how this exception is handled; don't just log and ignore it.
|
# 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}")
|
logger.error(f"An error occurred while trying to connect to server. {e}")
|
||||||
|
|
||||||
|
return {}
|
||||||
|
|
|
@ -7,7 +7,7 @@ from monkey_island.cc.services.config import ConfigService
|
||||||
class PropagationCredentials(flask_restful.Resource):
|
class PropagationCredentials(flask_restful.Resource):
|
||||||
def get(self, guid: str):
|
def get(self, guid: str):
|
||||||
monkey_json = mongo.db.monkey.find_one_or_404({"guid": guid})
|
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(
|
propagation_credentials = ConfigService.get_config_propagation_credentials_from_flat_config(
|
||||||
monkey_json["config"]
|
monkey_json["config"]
|
||||||
|
|
|
@ -412,11 +412,11 @@ class ConfigService:
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_config_propagation_credentials_from_flat_config(config):
|
def get_config_propagation_credentials_from_flat_config(config):
|
||||||
return {
|
return {
|
||||||
"exploit_user_list": config["exploit_user_list"],
|
"exploit_user_list": config.get("exploit_user_list", []),
|
||||||
"exploit_password_list": config["exploit_password_list"],
|
"exploit_password_list": config.get("exploit_password_list", []),
|
||||||
"exploit_lm_hash_list": config["exploit_lm_hash_list"],
|
"exploit_lm_hash_list": config.get("exploit_lm_hash_list", []),
|
||||||
"exploit_ntlm_hash_list": config["exploit_ntlm_hash_list"],
|
"exploit_ntlm_hash_list": config.get("exploit_ntlm_hash_list", []),
|
||||||
"exploit_ssh_keys": config["exploit_ssh_keys"],
|
"exploit_ssh_keys": config.get("exploit_ssh_keys", []),
|
||||||
}
|
}
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|
Loading…
Reference in New Issue