csle_common.dao.emulation_action.defender package
Submodules
csle_common.dao.emulation_action.defender.emulation_defender_action module
- class csle_common.dao.emulation_action.defender.emulation_defender_action.EmulationDefenderAction(id: csle_common.dao.emulation_action.defender.emulation_defender_action_id.EmulationDefenderActionId, name: str, cmds: List[str], type: csle_common.dao.emulation_action.defender.emulation_defender_action_type.EmulationDefenderActionType, descr: str, ips: List[str], index: int, action_outcome: csle_common.dao.emulation_action.defender.emulation_defender_action_outcome.EmulationDefenderActionOutcome = EmulationDefenderActionOutcome.GAME_END, alt_cmds: Union[None, List[str]] = None, execution_time: float = 0.0, ts: float = 0.0)[source]
Bases:
csle_base.json_serializable.JSONSerializable
Class representing an action of the defender in the environment
- copy() csle_common.dao.emulation_action.defender.emulation_defender_action.EmulationDefenderAction [source]
- Returns
a copy of the DTO
- static from_dict(d: Dict[str, Any]) csle_common.dao.emulation_action.defender.emulation_defender_action.EmulationDefenderAction [source]
Converts a dict representation to an instance
- Parameters
d – the dict to convert
- Returns
the instance
- static from_json_file(json_file_path: str) csle_common.dao.emulation_action.defender.emulation_defender_action.EmulationDefenderAction [source]
Reads a json file and converts it to a DTO
- Parameters
json_file_path – the json file path
- Returns
the converted DTO
- static from_kafka_record(record: str) csle_common.dao.emulation_action.defender.emulation_defender_action.EmulationDefenderAction [source]
Converts a kafka record into an instance
- Parameters
record – the record to convert
- Returns
the created instance
- ips_match(ips: List[str]) bool [source]
Checks if a list of ips overlap with the ips of this host
- Parameters
ips – the list of ips to check
- Returns
True if they match, False otherwise
- static schema() csle_common.dao.emulation_action.defender.emulation_defender_action.EmulationDefenderAction [source]
- Returns
get the schema of the DTO
csle_common.dao.emulation_action.defender.emulation_defender_action_config module
- class csle_common.dao.emulation_action.defender.emulation_defender_action_config.EmulationDefenderActionConfig(num_indices: int, actions: Optional[List[csle_common.dao.emulation_action.defender.emulation_defender_action.EmulationDefenderAction]] = None, stopping_action_ids: Optional[List[csle_common.dao.emulation_action.defender.emulation_defender_action_id.EmulationDefenderActionId]] = None, multiple_stop_actions: Optional[List[csle_common.dao.emulation_action.defender.emulation_defender_action.EmulationDefenderAction]] = None, multiple_stop_actions_ids: Optional[List[csle_common.dao.emulation_action.defender.emulation_defender_action_id.EmulationDefenderActionId]] = None)[source]
Bases:
csle_base.json_serializable.JSONSerializable
Configuration of the action space for the defender
- static all_actions_config(num_nodes: int, subnet_masks: List[str]) csle_common.dao.emulation_action.defender.emulation_defender_action_config.EmulationDefenderActionConfig [source]
Creates an action configuration for the defender with all actions
- Parameters
num_nodes – the number of nodes in the environment
subnet_masks – the the subnet masks in the environment
- Returns
the action configuration
- static from_dict(d: Dict[str, Any]) csle_common.dao.emulation_action.defender.emulation_defender_action_config.EmulationDefenderActionConfig [source]
Converts a dict representation to an instance
- Parameters
d – the dict to convert
- Returns
the created instance
- static from_json_file(json_file_path: str) csle_common.dao.emulation_action.defender.emulation_defender_action_config.EmulationDefenderActionConfig [source]
Reads a json file and converts it to a DTO
- Parameters
json_file_path – the json file path
- Returns
the converted DTO
csle_common.dao.emulation_action.defender.emulation_defender_action_id module
csle_common.dao.emulation_action.defender.emulation_defender_action_outcome module
Type of defense action outcomes
csle_common.dao.emulation_action.defender.emulation_defender_action_type module
Type of defense actions
csle_common.dao.emulation_action.defender.emulation_defender_stopping_actions module
- class csle_common.dao.emulation_action.defender.emulation_defender_stopping_actions.EmulationDefenderStoppingActions[source]
Bases:
object
Class implementing stopping actions for the defender
- static BLACKLIST_IPS(index: int) csle_common.dao.emulation_action.defender.emulation_defender_action.EmulationDefenderAction [source]
A non terminal stop action, the defender blacklists all IPs that generate IDS alerts that exceed a threshold, the blacklist is implemented using the firewall.
- Parameters
index – index of the machine to apply the action to
- Returns
the action
- static CONTINUE(index: int) csle_common.dao.emulation_action.defender.emulation_defender_action.EmulationDefenderAction [source]
A “continue” action, the defender chooses to not make any action
- Parameters
index – index of the machine to apply the action to
- Returns
the action
- static ENABLE_DPI(index: int) csle_common.dao.emulation_action.defender.emulation_defender_action.EmulationDefenderAction [source]
A non terminal stop action, the defender enables DPI by starting the IDS
- Parameters
index – index of the machine to apply the action to
- Returns
the action
- static RESET_USERS(index: int) csle_common.dao.emulation_action.defender.emulation_defender_action.EmulationDefenderAction [source]
A non terminal stop action, the defender resets all user accounts, which means that password vulnerabilities are mitigated.
- Parameters
index – index of the machine to apply the action to
- Returns
the action
- static STOP(index: int) csle_common.dao.emulation_action.defender.emulation_defender_action.EmulationDefenderAction [source]
Reports a detected intrusion and stops
- Parameters
index – index of the machine to apply the action to
- Returns
the action