forked from p34709852/monkey
Agent: Use IIslandAPIClient.get_agent_signals in ControlChannel
This commit is contained in:
parent
88c011e883
commit
3da90223fc
|
@ -36,7 +36,7 @@ class ControlChannel(IControlChannel):
|
|||
if not self._control_channel_server:
|
||||
logger.error("Agent should stop because it can't connect to the C&C server.")
|
||||
return True
|
||||
return self._island_api_client.should_agent_stop(self._agent_id)
|
||||
return self._island_api_client.get_agent_signals(self._agent_id) is not None
|
||||
|
||||
@handle_island_api_errors
|
||||
def get_config(self) -> AgentConfiguration:
|
||||
|
|
|
@ -35,14 +35,14 @@ def control_channel(island_api_client) -> ControlChannel:
|
|||
|
||||
def test_control_channel__should_agent_stop(control_channel, island_api_client):
|
||||
control_channel.should_agent_stop()
|
||||
assert island_api_client.should_agent_stop.called_once()
|
||||
assert island_api_client.get_agent_signals.called_once()
|
||||
|
||||
|
||||
@pytest.mark.parametrize("api_error", CONTROL_CHANNEL_API_ERRORS)
|
||||
def test_control_channel__should_agent_stop_raises_error(
|
||||
control_channel, island_api_client, api_error
|
||||
):
|
||||
island_api_client.should_agent_stop.side_effect = api_error()
|
||||
island_api_client.get_agent_signals.side_effect = api_error()
|
||||
|
||||
with pytest.raises(IslandCommunicationError):
|
||||
control_channel.should_agent_stop()
|
||||
|
|
Loading…
Reference in New Issue