forked from p34709852/monkey
Agent: Modify ControlChannel to use AgentConfiguration endpoint
This commit is contained in:
parent
98a9fd3285
commit
b564e71d89
|
@ -52,17 +52,16 @@ class ControlChannel(IControlChannel):
|
||||||
def get_config(self) -> AgentConfiguration:
|
def get_config(self) -> AgentConfiguration:
|
||||||
try:
|
try:
|
||||||
response = requests.get( # noqa: DUO123
|
response = requests.get( # noqa: DUO123
|
||||||
f"https://{self._control_channel_server}/api/agent",
|
f"https://{self._control_channel_server}/api/agent-configuration",
|
||||||
verify=False,
|
verify=False,
|
||||||
proxies=self._proxies,
|
proxies=self._proxies,
|
||||||
timeout=SHORT_REQUEST_TIMEOUT,
|
timeout=SHORT_REQUEST_TIMEOUT,
|
||||||
)
|
)
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
|
|
||||||
config_dict = json.loads(response.text)["config"]
|
|
||||||
logger.debug(f"Received configuration:\n{pformat(json.loads(response.text))}")
|
logger.debug(f"Received configuration:\n{pformat(json.loads(response.text))}")
|
||||||
|
|
||||||
return AgentConfiguration.from_mapping(config_dict)
|
return AgentConfiguration.from_json(response.text)
|
||||||
except (
|
except (
|
||||||
json.JSONDecodeError,
|
json.JSONDecodeError,
|
||||||
requests.exceptions.ConnectionError,
|
requests.exceptions.ConnectionError,
|
||||||
|
|
Loading…
Reference in New Issue