#3087 Addressing docustring TODO's and a few minor spelling mistakes.
This commit is contained in:
@@ -148,7 +148,7 @@ class TAP001(AbstractTAP, discriminator="tap-001"):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
class AgentSettingsSchema(AbstractTAP.AgentSettingsSchema):
|
class AgentSettingsSchema(AbstractTAP.AgentSettingsSchema):
|
||||||
"""TODO."""
|
"""TAP001's AgentSettings schema (Expands upon the inherited AbstractTAP `AgentSettingsSchema`)."""
|
||||||
|
|
||||||
target_ips: Optional[List[StrIP]] = []
|
target_ips: Optional[List[StrIP]] = []
|
||||||
default_target_ip: StrIP
|
default_target_ip: StrIP
|
||||||
@@ -178,11 +178,10 @@ class TAP001(AbstractTAP, discriminator="tap-001"):
|
|||||||
"Dictionary containing all C2 stage relevant user settings."
|
"Dictionary containing all C2 stage relevant user settings."
|
||||||
payload_settings: dict = {}
|
payload_settings: dict = {}
|
||||||
"Dictionary containing all Payload stage relevant internal and user settings."
|
"Dictionary containing all Payload stage relevant internal and user settings."
|
||||||
|
|
||||||
chosen_application: str = ""
|
chosen_application: str = ""
|
||||||
"""The name of the agent's currently chosen application."""
|
"""The name of the agent's currently chosen application."""
|
||||||
target_ip: Optional[IPV4Address] = None # TODO: make it not optional?
|
target_ip: Optional[IPV4Address] = None
|
||||||
"""The name (string) of TAP agent's target node. This attribute is initialised via _select_target_node."""
|
"""TAP001's current target ip. This attribute is changed dynamically through out the kill chain."""
|
||||||
|
|
||||||
network_knowledge: Dict = {}
|
network_knowledge: Dict = {}
|
||||||
|
|
||||||
|
|||||||
@@ -18,17 +18,23 @@ class InsiderKillChainOptions(KillChainOptions):
|
|||||||
"""Model validation for TAP003's Kill Chain."""
|
"""Model validation for TAP003's Kill Chain."""
|
||||||
|
|
||||||
class _PlanningOptions(KillChainStageOptions):
|
class _PlanningOptions(KillChainStageOptions):
|
||||||
"""..."""
|
"""Valid options for the `PLANNING` InsiderKillChain stage."""
|
||||||
|
|
||||||
starting_network_knowledge: Dict # TODO: more specific schema here?
|
starting_network_knowledge: Dict # TODO: more specific schema here?
|
||||||
|
|
||||||
class _AccessOptions(KillChainStageOptions):
|
class _AccessOptions(KillChainStageOptions):
|
||||||
|
"""Valid options for the `ACCESS` InsiderKillChain stage."""
|
||||||
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
class _ManipulationOptions(KillChainStageOptions):
|
class _ManipulationOptions(KillChainStageOptions):
|
||||||
|
"""Valid options for the `MANIPULATION` InsiderKillChain stage."""
|
||||||
|
|
||||||
account_changes: List[Dict] = [] # TODO: More specific schema here?
|
account_changes: List[Dict] = [] # TODO: More specific schema here?
|
||||||
|
|
||||||
class _ExploitOptions(KillChainStageOptions):
|
class _ExploitOptions(KillChainStageOptions):
|
||||||
|
"""Valid options for the `EXPLOIT` InsiderKillChain stage."""
|
||||||
|
|
||||||
malicious_acls: List[RouterACLAddRuleAction.ConfigSchema] = []
|
malicious_acls: List[RouterACLAddRuleAction.ConfigSchema] = []
|
||||||
|
|
||||||
PLANNING: _PlanningOptions = Field(default_factory=lambda: InsiderKillChainOptions._PlanningOptions())
|
PLANNING: _PlanningOptions = Field(default_factory=lambda: InsiderKillChainOptions._PlanningOptions())
|
||||||
@@ -92,7 +98,7 @@ class TAP003(AbstractTAP, discriminator="tap-003"):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
class AgentSettingsSchema(AbstractTAP.AgentSettingsSchema):
|
class AgentSettingsSchema(AbstractTAP.AgentSettingsSchema):
|
||||||
"""TODO."""
|
"""Agent Settings Schema that enforces TAP003's `kill_chain` config to use the InsiderKillChainOptions."""
|
||||||
|
|
||||||
kill_chain: InsiderKillChainOptions # = Field(default_factory=lambda: MobileMalwareKillChainOptions())
|
kill_chain: InsiderKillChainOptions # = Field(default_factory=lambda: MobileMalwareKillChainOptions())
|
||||||
|
|
||||||
@@ -103,10 +109,8 @@ class TAP003(AbstractTAP, discriminator="tap-003"):
|
|||||||
agent_settings: "TAP003.AgentSettingsSchema" = Field(default_factory=lambda: TAP003.AgentSettingsSchema())
|
agent_settings: "TAP003.AgentSettingsSchema" = Field(default_factory=lambda: TAP003.AgentSettingsSchema())
|
||||||
|
|
||||||
config: ConfigSchema
|
config: ConfigSchema
|
||||||
|
|
||||||
selected_kill_chain: Type[InsiderKillChain] = InsiderKillChain
|
selected_kill_chain: Type[InsiderKillChain] = InsiderKillChain
|
||||||
_current_acl: int = 0
|
_current_acl: int = 0
|
||||||
|
|
||||||
network_knowledge: Dict = {} # TODO: more specific typing
|
network_knowledge: Dict = {} # TODO: more specific typing
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
@@ -280,7 +284,7 @@ class TAP003(AbstractTAP, discriminator="tap-003"):
|
|||||||
Second stage in the Insider kill chain.
|
Second stage in the Insider kill chain.
|
||||||
Performs a trial using the given user PLANNING stage probability.
|
Performs a trial using the given user PLANNING stage probability.
|
||||||
|
|
||||||
If the trial is successful then the agent populates its knowledgebase with information from the config.
|
If the trial is successful then the agent populates its knowledge base with information from the config.
|
||||||
|
|
||||||
Otherwise, the stage is not progressed. Additionally, the agent's kill chain is set
|
Otherwise, the stage is not progressed. Additionally, the agent's kill chain is set
|
||||||
to failure if the repeat_kill_chain_stages parameter is set to FALSE.
|
to failure if the repeat_kill_chain_stages parameter is set to FALSE.
|
||||||
@@ -298,7 +302,7 @@ class TAP003(AbstractTAP, discriminator="tap-003"):
|
|||||||
"credentials"
|
"credentials"
|
||||||
] = self.config.agent_settings.kill_chain.PLANNING.starting_network_knowledge["credentials"]
|
] = self.config.agent_settings.kill_chain.PLANNING.starting_network_knowledge["credentials"]
|
||||||
self.current_host = self.starting_node
|
self.current_host = self.starting_node
|
||||||
self.logger.info("Resolving starting knoweldge.")
|
self.logger.info("Resolving starting knowledge.")
|
||||||
self._progress_kill_chain()
|
self._progress_kill_chain()
|
||||||
if self.current_stage_progress == KillChainStageProgress.PENDING:
|
if self.current_stage_progress == KillChainStageProgress.PENDING:
|
||||||
self.logger.info(f"TAP003 reached the {self.current_kill_chain_stage.name}")
|
self.logger.info(f"TAP003 reached the {self.current_kill_chain_stage.name}")
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ class AbstractTAP(AbstractScriptedAgent):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
class AgentSettingsSchema(AbstractScriptedAgent.AgentSettingsSchema):
|
class AgentSettingsSchema(AbstractScriptedAgent.AgentSettingsSchema):
|
||||||
"""TODO."""
|
"""Agent Settings Schema. Default settings applied for all threat actor profiles."""
|
||||||
|
|
||||||
start_step: int = 5
|
start_step: int = 5
|
||||||
frequency: int = 5
|
frequency: int = 5
|
||||||
|
|||||||
Reference in New Issue
Block a user