From f074b3e3880d303f555ea6b511c294aeac0029ab Mon Sep 17 00:00:00 2001 From: Mike Salvatore Date: Wed, 1 Dec 2021 12:18:32 -0500 Subject: [PATCH] Agent: Pass agent_id to ControlChannel constructor --- monkey/infection_monkey/master/control_channel.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/monkey/infection_monkey/master/control_channel.py b/monkey/infection_monkey/master/control_channel.py index e56052539..9e8046baf 100644 --- a/monkey/infection_monkey/master/control_channel.py +++ b/monkey/infection_monkey/master/control_channel.py @@ -4,7 +4,7 @@ import logging import requests from common.common_consts.timeouts import SHORT_REQUEST_TIMEOUT -from infection_monkey.config import GUID, WormConfiguration +from infection_monkey.config import WormConfiguration from infection_monkey.control import ControlClient from monkey.infection_monkey.i_control_channel import IControlChannel @@ -14,7 +14,8 @@ logger = logging.getLogger(__name__) class ControlChannel(IControlChannel): - def __init__(self, server: str): + def __init__(self, server: str, agent_id: str): + self._agent_id = agent_id self._control_channel_server = server def should_agent_stop(self) -> bool: @@ -23,7 +24,7 @@ class ControlChannel(IControlChannel): try: response = requests.get( # noqa: DUO123 - f"{self._control_channel_server}/api/monkey_control/{GUID}", + f"{self._control_channel_server}/api/monkey_control/{self._agent_id}", verify=False, timeout=SHORT_REQUEST_TIMEOUT, )