#2689 Addressed more PR comments & fixed an bug with command parsing in _command_terminal (c2 beacon)

This commit is contained in:
Archer Bowen
2024-08-16 10:24:53 +01:00
parent e5be392ea8
commit 849cb20f35
6 changed files with 41 additions and 32 deletions

View File

@@ -75,7 +75,7 @@ class AbstractC2(Application, identifier="AbstractC2"):
keep_alive_inactivity: int = 0
"""Indicates how many timesteps since the last time the c2 application received a keep alive."""
class _C2_Opts(BaseModel):
class C2_Opts(BaseModel):
"""A Pydantic Schema for the different C2 configuration options."""
keep_alive_frequency: int = Field(default=5, ge=1)
@@ -87,7 +87,7 @@ class AbstractC2(Application, identifier="AbstractC2"):
masquerade_port: Port = Field(default=Port.HTTP)
"""The currently chosen port that the C2 traffic is masquerading as. Defaults at HTTP."""
c2_config: _C2_Opts = _C2_Opts()
c2_config: C2_Opts = C2_Opts()
"""
Holds the current configuration settings of the C2 Suite.

View File

@@ -493,8 +493,9 @@ class C2Beacon(AbstractC2, identifier="C2Beacon"):
)
# Converts a singular terminal command: [RequestFormat] into a list with one element [[RequestFormat]]
# Checks the first element - if this element is a str then there must be multiple commands.
command_opts.commands = (
[command_opts.commands] if not isinstance(command_opts.commands, list) else command_opts.commands
[command_opts.commands] if isinstance(command_opts.commands[0], str) else command_opts.commands
)
for index, given_command in enumerate(command_opts.commands):