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
- 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
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
- 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
- static schema() csle_common.dao.emulation_observation.attacker.emulation_attacker_observation_state.EmulationAttackerObservationState [source]
- Returns
get the schema of the DTO