#2689 Overhauled .receive method. Keep Alive and initial implementation of commands working. (also Updated docustrings + pre-commit)

This commit is contained in:
Archer.Bowen
2024-08-02 13:25:08 +01:00
parent e554a2d224
commit 2339dabac1
6 changed files with 382 additions and 212 deletions

View File

@@ -5,19 +5,6 @@ from typing import Optional
from primaite.simulator.network.protocols.packet import DataPacket
class C2Payload(Enum):
"""Represents the different types of command and control payloads."""
KEEP_ALIVE = "keep_alive"
"""C2 Keep Alive payload. Used by the C2 beacon and C2 Server to confirm their connection."""
INPUT = "input_command"
"""C2 Input Command payload. Used by the C2 Server to send a command to the c2 beacon."""
OUTPUT = "output_command"
"""C2 Output Command. Used by the C2 Beacon to send the results of a Input command to the c2 server."""
class MasqueradePacket(DataPacket):
"""Represents an generic malicious packet that is masquerading as another protocol."""
@@ -25,6 +12,6 @@ class MasqueradePacket(DataPacket):
masquerade_port: Enum # The 'Masquerade' port that is currently in use
payload_type: C2Payload # The type of C2 traffic (e.g keep alive, command or command out)
payload_type: Enum # The type of C2 traffic (e.g keep alive, command or command out)
command: Optional[str] # Used to pass the actual C2 Command in C2 INPUT
command: Optional[Enum] = None # Used to pass the actual C2 Command in C2 INPUT