#2888 - fix software config issues
This commit is contained in:
@@ -53,6 +53,16 @@ class C2Beacon(AbstractC2, identifier="C2Beacon"):
|
|||||||
terminal_session: TerminalClientConnection = None
|
terminal_session: TerminalClientConnection = None
|
||||||
"The currently in use terminal session."
|
"The currently in use terminal session."
|
||||||
|
|
||||||
|
def __init__(self, **kwargs):
|
||||||
|
kwargs["name"] = "C2Beacon"
|
||||||
|
super().__init__(**kwargs)
|
||||||
|
self.configure(
|
||||||
|
c2_server_ip_address=self.config.c2_server_ip_address,
|
||||||
|
keep_alive_frequency=self.config.keep_alive_frequency,
|
||||||
|
masquerade_port=self.config.masquerade_port,
|
||||||
|
masquerade_protocol=self.config.masquerade_protocol,
|
||||||
|
)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def _host_terminal(self) -> Optional[Terminal]:
|
def _host_terminal(self) -> Optional[Terminal]:
|
||||||
"""Return the Terminal that is installed on the same machine as the C2 Beacon."""
|
"""Return the Terminal that is installed on the same machine as the C2 Beacon."""
|
||||||
@@ -131,10 +141,6 @@ class C2Beacon(AbstractC2, identifier="C2Beacon"):
|
|||||||
rm.add_request("configure", request_type=RequestType(func=_configure))
|
rm.add_request("configure", request_type=RequestType(func=_configure))
|
||||||
return rm
|
return rm
|
||||||
|
|
||||||
def __init__(self, **kwargs):
|
|
||||||
kwargs["name"] = "C2Beacon"
|
|
||||||
super().__init__(**kwargs)
|
|
||||||
|
|
||||||
# Configure is practically setter method for the ``c2.config`` attribute that also ties into the request manager.
|
# Configure is practically setter method for the ``c2.config`` attribute that also ties into the request manager.
|
||||||
@validate_call
|
@validate_call
|
||||||
def configure(
|
def configure(
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ class Software(SimComponent, ABC):
|
|||||||
model_config = ConfigDict(extra="forbid")
|
model_config = ConfigDict(extra="forbid")
|
||||||
starting_health_state: SoftwareHealthState = SoftwareHealthState.UNUSED
|
starting_health_state: SoftwareHealthState = SoftwareHealthState.UNUSED
|
||||||
criticality: SoftwareCriticality = SoftwareCriticality.LOWEST
|
criticality: SoftwareCriticality = SoftwareCriticality.LOWEST
|
||||||
fixing_duration: int = 2
|
fix_duration: int = 2
|
||||||
|
|
||||||
config: ConfigSchema = Field(default_factory=lambda: Software.ConfigSchema())
|
config: ConfigSchema = Field(default_factory=lambda: Software.ConfigSchema())
|
||||||
|
|
||||||
@@ -117,9 +117,9 @@ class Software(SimComponent, ABC):
|
|||||||
|
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
super().__init__(**kwargs)
|
super().__init__(**kwargs)
|
||||||
self.health_state_actual = self.config.starting_health_state
|
self.health_state_actual = self.config.starting_health_state # don't remove this
|
||||||
self.criticality = self.config.criticality
|
self.criticality = self.config.criticality
|
||||||
self.fixing_duration = self.config.fixing_duration
|
self.fixing_duration = self.config.fix_duration
|
||||||
|
|
||||||
def _init_request_manager(self) -> RequestManager:
|
def _init_request_manager(self) -> RequestManager:
|
||||||
"""
|
"""
|
||||||
|
|||||||
Reference in New Issue
Block a user