csle_common.dao.emulation_observation.attacker package

Submodules

csle_common.dao.emulation_observation.attacker.emulation_attacker_machine_observation_state module

class csle_common.dao.emulation_observation.attacker.emulation_attacker_machine_observation_state.EmulationAttackerMachineObservationState(ips: List[str])[source]

Bases: csle_base.json_serializable.JSONSerializable

Represents the attacker’s belief state of a component in the emulation

cleanup()[source]

Cleans up environment state. This method is particularly useful in emulation mode where there are SSH/Telnet/FTP… connections that should be cleaned up, as well as background threads.

Returns

None

copy() csle_common.dao.emulation_observation.attacker.emulation_attacker_machine_observation_state.EmulationAttackerMachineObservationState[source]
Returns

a copy of the DTO

static from_dict(d: Dict[str, Any]) csle_common.dao.emulation_observation.attacker.emulation_attacker_machine_observation_state.EmulationAttackerMachineObservationState[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_observation.attacker.emulation_attacker_machine_observation_state.EmulationAttackerMachineObservationState[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_nmap_result(nmap_host_result: csle_common.dao.emulation_action_result.nmap_host_result.NmapHostResult) csle_common.dao.emulation_observation.attacker.emulation_attacker_machine_observation_state.EmulationAttackerMachineObservationState[source]

Converts the NmapHostResultDTO into a AttackerMachineObservationState

Returns

the created AttackerMachineObservationState

ips_match(ips: List[str]) bool[source]

Checks if a list of ips overlap with the ips of this machine

Parameters

ips – the list of ips to check

Returns

True if they match, False otherwise

num_attributes() int[source]
Returns

number of attributes of the DTO

static schema() csle_common.dao.emulation_observation.attacker.emulation_attacker_machine_observation_state.EmulationAttackerMachineObservationState[source]
Returns

get the schema of the DTO

sort_cve_vuln(vuln_lookup) None[source]

Sorts the list of vulnerabilities

Parameters

vuln_lookup – a lookup table for converting vulnerabilities between ids and names

Returns

None

sort_osvdb_vuln() None[source]

Sorts the OSVDB vulnerabilities

Returns

None

sort_ports() None[source]

Sorts the list of ports :return: None

sort_shell_access(service_lookup) None[source]

Sorts the list of shell access credentials

Parameters

service_lookup – a lookup table for converting between service names and service ids

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_observation.attacker.emulation_attacker_observation_state module

class csle_common.dao.emulation_observation.attacker.emulation_attacker_observation_state.EmulationAttackerObservationState(catched_flags: int, agent_reachable: Set[str])[source]

Bases: csle_base.json_serializable.JSONSerializable

Represents the attacker’s agent’s current belief state of the emulation

cleanup() None[source]

Cleanup machine states

Returns

None

copy() csle_common.dao.emulation_observation.attacker.emulation_attacker_observation_state.EmulationAttackerObservationState[source]
Returns

a copy of the state

exploit_executed(machine: csle_common.dao.emulation_observation.attacker.emulation_attacker_machine_observation_state.EmulationAttackerMachineObservationState) bool[source]

Check if exploit have been tried on a particular machine

Parameters

machine – the machine

Returns

true if some exploit have been launched, false otherwise

exploit_tried(a: csle_common.dao.emulation_action.attacker.emulation_attacker_action.EmulationAttackerAction, m: Optional[csle_common.dao.emulation_observation.attacker.emulation_attacker_machine_observation_state.EmulationAttackerMachineObservationState]) bool[source]

Checks if a given exploit have been tried on a given machine or not

Parameters
  • a – the exploit action

  • m – the machine

Returns

true if it has already been tried, otherwise false

static from_dict(d: Dict[str, Any]) csle_common.dao.emulation_observation.attacker.emulation_attacker_observation_state.EmulationAttackerObservationState[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_observation.attacker.emulation_attacker_observation_state.EmulationAttackerObservationState[source]

Reads a json file and converts it to a DTO

Parameters

json_file_path – the json file path

Returns

the converted DTO

get_action_ips(a: csle_common.dao.emulation_action.attacker.emulation_attacker_action.EmulationAttackerAction, emulation_env_config: csle_common.dao.emulation_config.emulation_env_config.EmulationEnvConfig) List[str][source]

Returns the ip of the machine that the action targets

Parameters
  • a – the action

  • emulation_env_config – the emulation env config

Returns

the ip of the target

num_attributes()[source]
Returns

number of attributes of the DTO

static schema() csle_common.dao.emulation_observation.attacker.emulation_attacker_observation_state.EmulationAttackerObservationState[source]
Returns

get the schema of the DTO

sort_machines() None[source]

Sorts the machines in the observation

Returns

None

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

Converts the object to a dict representation

Returns

a dict representation of the object

Module contents