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

num_attributes() int[source]
Returns

The number of attributes of the DTO

static schema() csle_common.dao.emulation_action.defender.emulation_defender_action.EmulationDefenderAction[source]
Returns

get the schema of the DTO

to_dict() Dict[str, Any][source]
Returns

a dicr representation of the object

to_kafka_record() str[source]

Converts the instance into a kafka record format

Parameters

total_time – the total time of execution

Returns

the kafka record

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

get_continue_action_idx() int[source]
Returns

the index of the continue action

print_actions() None[source]

Utility function for printing the list of actions

Returns

None

to_dict() Dict[str, Any][source]

Converts the object to a dict representation

Returns

a dict representation of the object

csle_common.dao.emulation_action.defender.emulation_defender_action_id module

class csle_common.dao.emulation_action.defender.emulation_defender_action_id.EmulationDefenderActionId(value)[source]

Bases: enum.IntEnum

Enum representing the different defenses

BLACKLIST_IPS = 4
CONTINUE = 1
ENABLE_DPI = 3
RESET_USERS = 2
STOP = 0

csle_common.dao.emulation_action.defender.emulation_defender_action_outcome module

Type of defense action outcomes

class csle_common.dao.emulation_action.defender.emulation_defender_action_outcome.EmulationDefenderActionOutcome(value)[source]

Bases: enum.IntEnum

Enum representing the different defense outcomes in the network.

ADD_DEFENSIVE_MECHANISM = 3
CONTINUE = 1
GAME_END = 0
STATE_UPDATE = 2

csle_common.dao.emulation_action.defender.emulation_defender_action_type module

Type of defense actions

class csle_common.dao.emulation_action.defender.emulation_defender_action_type.EmulationDefenderActionType(value)[source]

Bases: enum.IntEnum

Enum representing the different defense types in the network.

ADD_DEFENSIVE_MECHANISM = 2
CONTINUE = 1
STOP = 0

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

Module contents