#2689 minor docustring and type hint change

This commit is contained in:
Archer.Bowen
2024-07-31 10:26:58 +01:00
parent e4358b02bc
commit f097ed575d
3 changed files with 4 additions and 2 deletions

View File

@@ -191,7 +191,7 @@ class AbstractC2(Application):
"""
return self._handle_c2_payload(payload, session_id)
def _send_keep_alive(self) -> bool:
def _send_keep_alive(self, session_id: Optional[str]) -> bool:
"""Sends a C2 keep alive payload to the self.remote_connection IPv4 Address."""
# Checking that the c2 application is capable of performing both actions and has an enabled NIC
# (Using NOT to improve code readability)
@@ -217,6 +217,7 @@ class AbstractC2(Application):
dest_ip_address=self.c2_remote_connection,
port=self.current_masquerade_port,
protocol=self.current_masquerade_protocol,
session_id=session_id,
):
self.sys_log.info(f"{self.name}: Keep Alive sent to {self.c2_remote_connection}")
self.sys_log.debug(f"{self.name}: on {self.current_masquerade_port} via {self.current_masquerade_protocol}")

View File

@@ -261,7 +261,7 @@ class C2Beacon(AbstractC2):
def _check_c2_connection(self, timestep) -> bool:
"""Checks the C2 Server connection. If a connection cannot be confirmed then the c2 beacon will halt and close."""
"""Checks the C2 Server connection. If a connection cannot be confirmed then this method will return false otherwise true."""
if self.keep_alive_inactivity > self.keep_alive_frequency:
self.sys_log.info(f"{self.name}: Keep Alive sent to {self.c2_remote_connection} at timestep {timestep}.")
self._send_keep_alive()

View File

@@ -11,3 +11,4 @@ class C2Server(AbstractC2):
def _handle_command_output(payload):
"""Abstract Method: Used in C2 server to parse and receive the output of commands sent to the c2 beacon."""
pass