pylint fix for caldera 4 api. For some classes I just do not know the exact Caldera definition

more_unit_tests
Thorsten Sick 2 years ago
parent 1f75d6cfc6
commit 2b6b00fd8e

@ -19,13 +19,13 @@ from pydantic import conlist # pylint: disable=no-name-in-module
# TODO: Support all Caldera agents: "Sandcat (GoLang)","Elasticat (Blue Python/ Elasticsearch)","Manx (Reverse Shell TCP)","Ragdoll (Python/HTML)" # TODO: Support all Caldera agents: "Sandcat (GoLang)","Elasticat (Blue Python/ Elasticsearch)","Manx (Reverse Shell TCP)","Ragdoll (Python/HTML)"
@dataclass @dataclass
class Variation: class Variation: # pylint: disable=missing-class-docstring
description: str description: str
command: str command: str
@dataclass @dataclass
class ParserConfig: class ParserConfig: # pylint: disable=missing-class-docstring
source: str source: str
edge: str edge: str
target: str target: str
@ -33,27 +33,27 @@ class ParserConfig:
@dataclass @dataclass
class Parser: class Parser: # pylint: disable=missing-class-docstring
module: str module: str
relationships: list[ParserConfig] # undocumented ! Needs improvement ! TODO relationships: list[ParserConfig] # undocumented ! Needs improvement ! TODO
parserconfigs: Optional[list[ParserConfig]] = None parserconfigs: Optional[list[ParserConfig]] = None
@dataclass @dataclass
class Requirement: class Requirement: # pylint: disable=missing-class-docstring
module: str module: str
relationship_match: list[dict] relationship_match: list[dict]
@dataclass @dataclass
class AdditionalInfo: class AdditionalInfo: # pylint: disable=missing-class-docstring
additionalProp1: Optional[str] = None # pylint: disable=invalid-name additionalProp1: Optional[str] = None # pylint: disable=invalid-name
additionalProp2: Optional[str] = None # pylint: disable=invalid-name additionalProp2: Optional[str] = None # pylint: disable=invalid-name
additionalProp3: Optional[str] = None # pylint: disable=invalid-name additionalProp3: Optional[str] = None # pylint: disable=invalid-name
@dataclass @dataclass
class Executor: class Executor: # pylint: disable=missing-class-docstring
build_target: Optional[str] # Why can this be None ? build_target: Optional[str] # Why can this be None ?
language: Optional[str] # Why can this be None ? language: Optional[str] # Why can this be None ?
payloads: list[str] payloads: list[str]
@ -104,11 +104,12 @@ class Ability:
@dataclass @dataclass
class AbilityList(): class AbilityList:
""" A list of exploits """ """ A list of exploits """
abilities: Annotated[list, conlist(Ability, min_items=1)] abilities: Annotated[list, conlist(Ability, min_items=1)]
def get_data(self): def get_data(self):
""" Get a specific element out of the internal data representation, behaves like the well know 'get' """
return self.abilities return self.abilities
@ -126,6 +127,7 @@ class ObfuscatorList:
obfuscators: Annotated[list, conlist(Obfuscator, min_items=1)] obfuscators: Annotated[list, conlist(Obfuscator, min_items=1)]
def get_data(self): def get_data(self):
""" Get a specific element out of the internal data representation, behaves like the well know 'get' """
return self.obfuscators return self.obfuscators
@ -155,11 +157,12 @@ class AdversaryList:
adversaries: Annotated[list, conlist(Adversary, min_items=1)] adversaries: Annotated[list, conlist(Adversary, min_items=1)]
def get_data(self): def get_data(self):
""" Get a specific element out of the internal data representation, behaves like the well know 'get' """
return self.adversaries return self.adversaries
@dataclass @dataclass
class Fact: class Fact: # pylint: disable=missing-class-docstring
unique: str unique: str
name: str name: str
score: int score: int
@ -183,7 +186,7 @@ class Fact:
@dataclass @dataclass
class Relationship: class Relationship: # pylint: disable=missing-class-docstring
target: Fact target: Fact
unique: str unique: str
score: int score: int
@ -193,13 +196,13 @@ class Relationship:
@dataclass @dataclass
class Visibility: class Visibility: # pylint: disable=missing-class-docstring
score: int score: int
adjustments: list[int] adjustments: list[int]
@dataclass @dataclass
class Link: class Link: # pylint: disable=missing-class-docstring
pin: int pin: int
ability: Ability ability: Ability
paw: str paw: str
@ -273,18 +276,19 @@ class AgentList:
agents: list[Agent] agents: list[Agent]
def get_data(self): def get_data(self):
""" Get a specific element out of the internal data representation, behaves like the well know 'get' """
return self.agents return self.agents
@dataclass @dataclass
class Rule: class Rule: # pylint: disable=missing-class-docstring
match: str match: str
trait: str trait: str
action: Optional[str] = None action: Optional[str] = None
@dataclass @dataclass
class Adjustment: class Adjustment: # pylint: disable=missing-class-docstring
offset: int offset: int
trait: str trait: str
value: str value: str
@ -292,7 +296,7 @@ class Adjustment:
@dataclass @dataclass
class Source: class Source: # pylint: disable=missing-class-docstring
name: str name: str
plugin: str plugin: str
facts: list[Fact] facts: list[Fact]
@ -310,10 +314,11 @@ class Source:
@dataclass @dataclass
class SourceList: class SourceList: # pylint: disable=missing-class-docstring
sources: list[Source] sources: list[Source]
def get_data(self): def get_data(self):
""" Get a specific element out of the internal data representation, behaves like the well know 'get' """
return self.sources return self.sources
@ -334,14 +339,16 @@ class Planner:
@dataclass @dataclass
class PlannerList: class PlannerList:
""" A list of planners"""
planners: list[Planner] planners: list[Planner]
def get_data(self): def get_data(self):
""" Get a specific element out of the internal data representation, behaves like the well know 'get' """
return self.planners return self.planners
@dataclass @dataclass
class Goal: class Goal: # pylint: disable=missing-class-docstring
target: str target: str
count: int count: int
achieved: bool achieved: bool
@ -350,7 +357,7 @@ class Goal:
@dataclass @dataclass
class Objective: class Objective: # pylint: disable=missing-class-docstring
percentage: int percentage: int
name: str name: str
goals: list[Goal] goals: list[Goal]
@ -396,17 +403,20 @@ class Operation:
@dataclass @dataclass
class OperationList: class OperationList:
""" A list of operations """
operations: Annotated[list, conlist(Operation)] operations: Annotated[list, conlist(Operation)]
def get_data(self): def get_data(self):
""" Get a specific element out of the internal data representation, behaves like the well know 'get' """
return self.operations return self.operations
@dataclass @dataclass
class ObjectiveList: class ObjectiveList: # pylint: disable=missing-class-docstring
objectives: Annotated[list, conlist(Objective)] objectives: Annotated[list, conlist(Objective)]
def get_data(self): def get_data(self):
""" Get a specific element out of the internal data representation, behaves like the well know 'get' """
return self.objectives return self.objectives

Loading…
Cancel
Save