From f595f44ce97d7f6aa2648ab274c6bdf6a7ed172e Mon Sep 17 00:00:00 2001 From: Archer Bowen Date: Mon, 19 Aug 2024 13:08:31 +0100 Subject: [PATCH] #2689 Implemented fixes to _check_connection following PR --- .../red_applications/c2/abstract_c2.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/primaite/simulator/system/applications/red_applications/c2/abstract_c2.py b/src/primaite/simulator/system/applications/red_applications/c2/abstract_c2.py index 82e740c5..3d096209 100644 --- a/src/primaite/simulator/system/applications/red_applications/c2/abstract_c2.py +++ b/src/primaite/simulator/system/applications/red_applications/c2/abstract_c2.py @@ -463,26 +463,26 @@ class AbstractC2(Application, identifier="AbstractC2"): :return: A tuple containing a boolean True/False and a corresponding Request Response :rtype: tuple[bool, RequestResponse] """ - if self._can_perform_network_action == False: + if not self._can_perform_network_action: self.sys_log.warning(f"{self.name}: Unable to make leverage networking resources. Rejecting Command.") - return [ + return ( False, RequestResponse( status="failure", data={"Reason": "Unable to access networking resources. Unable to send command."} ), - ] + ) if self.c2_remote_connection is False: self.sys_log.warning(f"{self.name}: C2 Application has yet to establish connection. Rejecting command.") - return [ + return ( False, RequestResponse( status="failure", data={"Reason": "C2 Application has yet to establish connection. Unable to send command."}, ), - ] + ) else: - return [ + return ( True, RequestResponse(status="success", data={"Reason": "C2 Application is able to send connections."}), - ] + )