#2689 Initial base class implementation

This commit is contained in:
Archer.Bowen
2024-07-30 11:17:10 +01:00
parent 2c2d140bf0
commit 556239a535
5 changed files with 258 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
# © Crown-owned copyright 2024, Defence Science and Technology Laboratory UK
from enum import Enum
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."""
masquerade_protocol: Enum # The 'Masquerade' protocol that is currently in use
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)
command: Optional[str] # Used to pass the actual C2 Command in C2 INPUT