csle_common.dao.container_config package

Submodules

csle_common.dao.container_config.container_env_config module

csle_common.dao.container_config.containers_config module

class csle_common.dao.emulation_config.containers_config.ContainersConfig(containers: List[csle_common.dao.emulation_config.node_container_config.NodeContainerConfig], agent_ip: str, router_ip: str, networks: List[csle_common.dao.emulation_config.container_network.ContainerNetwork], ids_enabled: bool, vulnerable_nodes=None, agent_reachable_nodes=None)[source]

Bases: csle_base.json_serializable.JSONSerializable

A DTO representing the configuration of the containers that make up an emulation environment

copy() csle_common.dao.emulation_config.containers_config.ContainersConfig[source]
Returns

a copy of the DTO

create_execution_config(ip_first_octet: int, physical_servers: List[str]) csle_common.dao.emulation_config.containers_config.ContainersConfig[source]

Creates a new config for an execution

Parameters
  • ip_first_octet – the first octet of the IP of the new execution

  • physical_servers – the physical servers where the execution will be deployed

Returns

the new config

static from_dict(d: Dict[str, Any]) csle_common.dao.emulation_config.containers_config.ContainersConfig[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_config.containers_config.ContainersConfig[source]

Reads a json file and converts it to a DTO

Parameters

json_file_path – the json file path

Returns

the converted DTO

get_agent_container() Optional[csle_common.dao.emulation_config.node_container_config.NodeContainerConfig][source]
Returns

get container of the attacker agent

get_agent_reachable_ips() List[str][source]
Returns

list of ips reachable for the attacker agent

get_container_from_full_name(name: str) Optional[csle_common.dao.emulation_config.node_container_config.NodeContainerConfig][source]

Utility function for getting the container

Parameters

name – the full name of the container

Returns

the container with the given ip or None

get_container_from_ip(ip: str) Optional[csle_common.dao.emulation_config.node_container_config.NodeContainerConfig][source]

Utility function for getting the container

Parameters

ip – the ip of the container

Returns

the container with the given ip or None

get_reachable_ips(container: csle_common.dao.emulation_config.node_container_config.NodeContainerConfig) List[str][source]

Get list of IP addresses reachable from a given container

Parameters

container – the container to get reachable IPs from

Returns

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

Converts the object to a dict representation

Returns

a dict representation of the object

csle_common.dao.container_config.created_env_config module

csle_common.dao.container_config.flags_config module

class csle_common.dao.emulation_config.flags_config.FlagsConfig(node_flag_configs: List[csle_common.dao.emulation_config.node_flags_config.NodeFlagsConfig])[source]

Bases: csle_base.json_serializable.JSONSerializable

A DTO representing the set of flags in an emulation environment

copy() csle_common.dao.emulation_config.flags_config.FlagsConfig[source]
Returns

a copy of the DTO

create_execution_config(ip_first_octet: int) csle_common.dao.emulation_config.flags_config.FlagsConfig[source]

Creates a new config for an execution

Parameters

ip_first_octet – the first octet of the IP of the new execution

Returns

the new config

static from_dict(d: Dict[str, Any]) csle_common.dao.emulation_config.flags_config.FlagsConfig[source]

Converts a dict representation to a an instance

Parameters

d – the dict to convert

Returns

the created instance

static from_json_file(json_file_path: str) csle_common.dao.emulation_config.flags_config.FlagsConfig[source]

Reads a json file and converts it to a DTO

Parameters

json_file_path – the json file path

Returns

the converted DTO

get_flags_for_ips(ips: List[str]) List[csle_common.dao.emulation_config.flag.Flag][source]

Get all flags for a list of ip addresses

Parameters

ips – the list of ip addresses to get flags for

Returns

the list of flags

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

Converts the object to a dict representation

Returns

a dict representation of the object

csle_common.dao.container_config.node_container_config module

class csle_common.dao.emulation_config.node_container_config.NodeContainerConfig(name: str, ips_and_networks: List[Tuple[str, csle_common.dao.emulation_config.container_network.ContainerNetwork]], version: str, level: str, restart_policy: str, suffix: str, os: str, execution_ip_first_octet: int = - 1, docker_gw_bridge_ip: str = '', physical_host_ip: str = '')[source]

Bases: csle_base.json_serializable.JSONSerializable

A DTO object representing an individual container in an emulation environment

copy() csle_common.dao.emulation_config.node_container_config.NodeContainerConfig[source]
Returns

a copy of the DTO

create_execution_config(ip_first_octet: int, physical_servers: List[str]) csle_common.dao.emulation_config.node_container_config.NodeContainerConfig[source]

Creates a new config for an execution

Parameters
  • ip_first_octet – the first octet of the IP of the new execution

  • physical_servers – the list of physical servers of the execution

Returns

the new config

static from_dict(d: Dict[str, Any]) csle_common.dao.emulation_config.node_container_config.NodeContainerConfig[source]

Converts a dict representation to an instance :param d: the dict to convert :return: the created instance

static from_json_file(json_file_path: str) csle_common.dao.emulation_config.node_container_config.NodeContainerConfig[source]

Reads a json file and converts it to a DTO

Parameters

json_file_path – the json file path

Returns

the converted DTO

get_full_name() str[source]
Returns

the full name

get_ips() List[str][source]
Returns

a list of ips that this container has

get_readable_name() str[source]
Returns

the readable name

reachable(reachable_ips: List[str]) bool[source]

Check if container is reachable given a list of reachable ips

Parameters

reachable_ips – the list of reachable ips

Returns

True if the container is reachable, false otherwise

static schema() csle_common.dao.emulation_config.node_container_config.NodeContainerConfig[source]
Returns

get the schema of the DTO

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

Converts the object to a dict representation

Returns

a dict representation of the object

csle_common.dao.container_config.node_firewall_config module

class csle_common.dao.emulation_config.node_firewall_config.NodeFirewallConfig(ips_gw_default_policy_networks: List[csle_common.dao.emulation_config.default_network_firewall_config.DefaultNetworkFirewallConfig], hostname: str, output_accept: Set[str], input_accept: Set[str], forward_accept: Set[str], output_drop: Set[str], input_drop: Set[str], forward_drop: Set[str], routes: Set[Tuple[str, str]], docker_gw_bridge_ip: str = '', physical_host_ip: str = '')[source]

Bases: csle_base.json_serializable.JSONSerializable

A DTO object representing a firewall configuration of a container in an emulation environment

copy() csle_common.dao.emulation_config.node_firewall_config.NodeFirewallConfig[source]
Returns

a copy of the DTO

create_execution_config(ip_first_octet: int) csle_common.dao.emulation_config.node_firewall_config.NodeFirewallConfig[source]

Creates a new config for an execution

Parameters

ip_first_octet – the first octet of the IP of the new execution

Returns

the new config

static from_dict(d: Dict[str, Any]) csle_common.dao.emulation_config.node_firewall_config.NodeFirewallConfig[source]

Converts a dict representation into an instance

Parameters

d – the dict to convert

Returns

the created instance

static from_json_file(json_file_path: str) csle_common.dao.emulation_config.node_firewall_config.NodeFirewallConfig[source]

Reads a json file and converts it to a DTO

Parameters

json_file_path – the json file path

Returns

the converted DTO

get_ips()[source]
Returns

list of ip addresses

static schema() csle_common.dao.emulation_config.node_firewall_config.NodeFirewallConfig[source]
Returns

get the schema of the DTO

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

Converts the object to a dict representation

Returns

a dict representation of the object

csle_common.dao.container_config.node_flags_config module

class csle_common.dao.emulation_config.node_flags_config.NodeFlagsConfig(ip: str, flags: List[csle_common.dao.emulation_config.flag.Flag], docker_gw_bridge_ip: str = '', physical_host_ip: str = '')[source]

Bases: csle_base.json_serializable.JSONSerializable

A DTO object representing the set of flags at a specific container in an emulation environment

copy() csle_common.dao.emulation_config.node_flags_config.NodeFlagsConfig[source]
Returns

a copy of the DTO

create_execution_config(ip_first_octet: int) csle_common.dao.emulation_config.node_flags_config.NodeFlagsConfig[source]

Creates a new config for an execution

Parameters

ip_first_octet – the first octet of the IP of the new execution

Returns

the new config

static from_dict(d: Dict[str, Any]) csle_common.dao.emulation_config.node_flags_config.NodeFlagsConfig[source]

Converts a dict representation of the object 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_config.node_flags_config.NodeFlagsConfig[source]

Reads a json file and converts it to a DTO

Parameters

json_file_path – the json file path

Returns

the converted DTO

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

Converts the object to a dict representation

Returns

a dict representation of the object

csle_common.dao.container_config.node_network_config module

Network configuration of a container in the emulation

class csle_common.dao.emulation_config.node_network_config.NodeNetworkConfig(interface: str = 'eth0', limit_packets_queue: int = 30000, packet_delay_ms: float = 0.1, packet_delay_jitter_ms: float = 0.025, packet_delay_correlation_percentage: float = 25, packet_delay_distribution: csle_common.dao.emulation_config.packet_delay_distribution_type.PacketDelayDistributionType = PacketDelayDistributionType.PARETO, packet_loss_type: csle_common.dao.emulation_config.packet_loss_type.PacketLossType = PacketLossType.GEMODEL, packet_loss_rate_random_percentage: float = 2, packet_loss_random_correlation_percentage: float = 25, loss_state_markov_chain_p13: float = 0.1, loss_state_markov_chain_p31: float = 0.1, loss_state_markov_chain_p32: float = 0.1, loss_state_markov_chain_p23: float = 0.1, loss_state_markov_chain_p14: float = 0.1, loss_gemodel_p: float = 0.0001, loss_gemodel_r: float = 0.999, loss_gemodel_h: float = 0.0001, loss_gemodel_k: float = 0.9999, packet_corrupt_percentage: float = 1e-05, packet_corrupt_correlation_percentage: float = 25, packet_duplicate_percentage: float = 1e-05, packet_duplicate_correlation_percentage: float = 25, packet_reorder_percentage: float = 0.0025, packet_reorder_correlation_percentage: float = 25, packet_reorder_gap: int = 5, rate_limit_mbit: float = 100, packet_overhead_bytes: int = 0, cell_overhead_bytes: int = 0)[source]

Bases: csle_base.json_serializable.JSONSerializable

A DTO object representing the network configuration of a specific container in an emulation environment

copy() csle_common.dao.emulation_config.node_network_config.NodeNetworkConfig[source]
Returns

a copy of the DTO

static from_dict(d: Dict[str, Any]) csle_common.dao.emulation_config.node_network_config.NodeNetworkConfig[source]

Converts a dict representation to an instance

Parameters

d – the dict to convert

Returns

the converted instance

static from_json_file(json_file_path: str) csle_common.dao.emulation_config.node_network_config.NodeNetworkConfig[source]

Reads a json file and converts it to a DTO

Parameters

json_file_path – the json file path

Returns

the converted DTO

static schema() csle_common.dao.emulation_config.node_network_config.NodeNetworkConfig[source]
Returns

get the schema of the DTO

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

Converts the object to a dict representation

Returns

a dict representation of the object

csle_common.dao.container_config.node_resources_config module

class csle_common.dao.emulation_config.node_resources_config.NodeResourcesConfig(container_name: str, num_cpus: int, available_memory_gb: int, ips_and_network_configs: List[Tuple[str, csle_common.dao.emulation_config.node_network_config.NodeNetworkConfig]], docker_gw_bridge_ip: str = '', physical_host_ip: str = '')[source]

Bases: csle_base.json_serializable.JSONSerializable

A DTO object representing the resources of a specific container in an emulation environment

copy() csle_common.dao.emulation_config.node_resources_config.NodeResourcesConfig[source]
Returns

a copy of the DTO

create_execution_config(ip_first_octet: int) csle_common.dao.emulation_config.node_resources_config.NodeResourcesConfig[source]

Creates a new config for an execution

Parameters

ip_first_octet – the first octet of the IP of the new execution

Returns

the new config

static from_dict(d: Dict[str, Any]) csle_common.dao.emulation_config.node_resources_config.NodeResourcesConfig[source]

Converts a dict representation into an instance

Parameters

d – the dict to convert

Returns

the created instance

static from_json_file(json_file_path: str) csle_common.dao.emulation_config.node_resources_config.NodeResourcesConfig[source]

Reads a json file and converts it to a DTO

Parameters

json_file_path – the json file path

Returns

the converted DTO

get_ips() List[str][source]
Returns

a list of ips

static schema() csle_common.dao.emulation_config.node_resources_config.NodeResourcesConfig[source]
Returns

get the schema of the DTO

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

Converts the object to a dict representation

Returns

a dict representation of the object

csle_common.dao.container_config.node_traffic_config module

class csle_common.dao.emulation_config.node_traffic_config.NodeTrafficConfig(ip: str, commands: List[str], traffic_manager_log_file: str, traffic_manager_log_dir: str, traffic_manager_max_workers: int, traffic_manager_port: int = 50043, docker_gw_bridge_ip: str = '', physical_host_ip: str = '')[source]

Bases: csle_base.json_serializable.JSONSerializable

A DTO object representing the traffic configuration of an individual container in an emulation

copy() csle_common.dao.emulation_config.node_traffic_config.NodeTrafficConfig[source]
Returns

a copy of the DTO

create_execution_config(ip_first_octet: int) csle_common.dao.emulation_config.node_traffic_config.NodeTrafficConfig[source]

Creates a new config for an execution

Parameters

ip_first_octet – the first octet of the IP of the new execution

Returns

the new config

static from_dict(d: Dict[str, Any]) csle_common.dao.emulation_config.node_traffic_config.NodeTrafficConfig[source]

Converts a dict representation into an instance

Parameters

d – the dict to convert

Returns

the created instance

static from_json_file(json_file_path: str) csle_common.dao.emulation_config.node_traffic_config.NodeTrafficConfig[source]

Reads a json file and converts it to a DTO

Parameters

json_file_path – the json file path

Returns

the converted DTO

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

Converts the object to a dict representation

Returns

a dict representation of the object

csle_common.dao.container_config.node_users_config module

class csle_common.dao.emulation_config.node_users_config.NodeUsersConfig(ip: str, users: List[csle_common.dao.emulation_config.user.User], docker_gw_bridge_ip: str = '', physical_host_ip: str = '')[source]

Bases: csle_base.json_serializable.JSONSerializable

A DTO object representing the users of a container in an emulation environment

copy() csle_common.dao.emulation_config.node_users_config.NodeUsersConfig[source]
Returns

a copy of the DTO

create_execution_config(ip_first_octet: int) csle_common.dao.emulation_config.node_users_config.NodeUsersConfig[source]

Creates a new config for an execution

Parameters

ip_first_octet – the first octet of the IP of the new execution

Returns

the new config

static from_dict(d: Dict[str, Any]) csle_common.dao.emulation_config.node_users_config.NodeUsersConfig[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_config.node_users_config.NodeUsersConfig[source]

Reads a json file and converts it to a DTO

Parameters

json_file_path – the json file path

Returns

the converted DTO

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

Converts the object to a dict representation

Returns

a dict representation of the object

csle_common.dao.container_config.node_vulnerability_config module

class csle_common.dao.emulation_config.node_vulnerability_config.NodeVulnerabilityConfig(ip: str, vuln_type: csle_common.dao.emulation_config.vulnerability_type.VulnType, name: str, port: Optional[int], protocol: csle_common.dao.emulation_config.transport_protocol.TransportProtocol, credentials: Optional[List[csle_common.dao.emulation_config.credential.Credential]] = None, cvss: float = 2.0, cve: Optional[str] = None, service: Optional[str] = None, root: bool = False, docker_gw_bridge_ip: str = '', physical_host_ip: str = '')[source]

Bases: csle_base.json_serializable.JSONSerializable

A DTO object representing a vulnerability of a container in the emulation environment

copy() csle_common.dao.emulation_config.node_vulnerability_config.NodeVulnerabilityConfig[source]
Returns

a copy of the DTO

create_execution_config(ip_first_octet: int) csle_common.dao.emulation_config.node_vulnerability_config.NodeVulnerabilityConfig[source]

Creates a new config for an execution

Parameters

ip_first_octet – the first octet of the IP of the new execution

Returns

the new config

static from_dict(d: Dict[str, Any]) csle_common.dao.emulation_config.node_vulnerability_config.NodeVulnerabilityConfig[source]

Convert a dict representation to a DTO representation

Returns

a dto representation of the object

static from_json_file(json_file_path: str) csle_common.dao.emulation_config.node_vulnerability_config.NodeVulnerabilityConfig[source]

Reads a json file and converts it to a DTO

Parameters

json_file_path – the json file path

Returns

the converted DTO

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

Converts the object to a dict representation

Returns

a dict representation of the object

csle_common.dao.container_config.packet_delay_distribution_type module

Type of delay distributions on a container’s network interface

class csle_common.dao.emulation_config.packet_delay_distribution_type.PacketDelayDistributionType(value)[source]

Bases: enum.IntEnum

Enum representing the different types of delay distributions to emulate on a container

NORMAL = 1
PARETO = 2
PARETONORMAL = 3
UNIFORM = 0

csle_common.dao.container_config.packet_loss_type module

Type of packet losses on a container’s network interface

class csle_common.dao.emulation_config.packet_loss_type.PacketLossType(value)[source]

Bases: enum.IntEnum

Enum representing the different types of packet losses to emulate on a container

GEMODEL = 2
RANDOM = 0
STATE = 1

csle_common.dao.container_config.priv_esc_vulnerability_config module

csle_common.dao.container_config.pw_vulnerability_config module

csle_common.dao.container_config.rce_vulnerability_config module

csle_common.dao.container_config.resources_config module

class csle_common.dao.emulation_config.resources_config.ResourcesConfig(node_resources_configurations: List[csle_common.dao.emulation_config.node_resources_config.NodeResourcesConfig])[source]

Bases: csle_base.json_serializable.JSONSerializable

A DTO representing the resources assigned to the containers in an emulation environment

copy() csle_common.dao.emulation_config.resources_config.ResourcesConfig[source]
Returns

a copy of the DTO

create_execution_config(ip_first_octet: int) csle_common.dao.emulation_config.resources_config.ResourcesConfig[source]

Creates a new config for an execution

Parameters

ip_first_octet – the first octet of the IP of the new execution

Returns

the new config

static from_dict(d: Dict[str, Any]) csle_common.dao.emulation_config.resources_config.ResourcesConfig[source]

Converts a dict representation into an instance

Parameters

d – the dict to convert

Returns

the created instance

static from_json_file(json_file_path: str) csle_common.dao.emulation_config.resources_config.ResourcesConfig[source]

Reads a json file and converts it to a DTO

Parameters

json_file_path – the json file path

Returns

the converted DTO

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

Converts the object to a dict representation

Returns

a dict representation of the object

csle_common.dao.container_config.sql_injection_vulnerability_config module

csle_common.dao.container_config.topology module

csle_common.dao.container_config.traffic_config module

class csle_common.dao.emulation_config.traffic_config.TrafficConfig(node_traffic_configs: List[csle_common.dao.emulation_config.node_traffic_config.NodeTrafficConfig], client_population_config: csle_common.dao.emulation_config.client_population_config.ClientPopulationConfig)[source]

Bases: csle_base.json_serializable.JSONSerializable

A DTO object representing the traffic configuration of an emulation environment

copy() csle_common.dao.emulation_config.traffic_config.TrafficConfig[source]
Returns

a copy of the DTO

create_execution_config(ip_first_octet: int) csle_common.dao.emulation_config.traffic_config.TrafficConfig[source]

Creates a new config for an execution

Parameters

ip_first_octet – the first octet of the IP of the new execution

Returns

the new config

static from_dict(d: Dict[str, Any]) csle_common.dao.emulation_config.traffic_config.TrafficConfig[source]

Converts a dict representation of the object into a an instance

Parameters

d – the dict to convert

Returns

the created instance

static from_json_file(json_file_path: str) csle_common.dao.emulation_config.traffic_config.TrafficConfig[source]

Reads a json file and converts it to a DTO

Parameters

json_file_path – the json file path

Returns

the converted DTO

get_node_traffic_config_by_ip(ip: str) Optional[csle_common.dao.emulation_config.node_traffic_config.NodeTrafficConfig][source]

Gets a node traffic config with a specific IP

Parameters

ip – the ip

Returns

the node traffic config or None

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

Converts the object to a dict representation

Returns

a dict representation of the object

csle_common.dao.container_config.users_config module

class csle_common.dao.emulation_config.users_config.UsersConfig(users_configs: List[csle_common.dao.emulation_config.node_users_config.NodeUsersConfig])[source]

Bases: csle_base.json_serializable.JSONSerializable

A DTO object representing the users configuration of an emulation environment

copy() csle_common.dao.emulation_config.users_config.UsersConfig[source]
Returns

a copy of the DTO

create_execution_config(ip_first_octet: int) csle_common.dao.emulation_config.users_config.UsersConfig[source]

Creates a new config for an execution

Parameters

ip_first_octet – the first octet of the IP of the new execution

Returns

the new config

static from_dict(d: Dict[str, Any]) csle_common.dao.emulation_config.users_config.UsersConfig[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_config.users_config.UsersConfig[source]

Reads a json file and converts it to a DTO

Parameters

json_file_path – the json file path

Returns

the converted DTO

get_root_usernames(ips: List[str]) List[str][source]

Gets the root usernames for a list of ips

Parameters

ips – the list of ips to get the root usernames for

Returns

the list of root usernames

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

Converts the object to a dict representation

Returns

a dict representation of the object

csle_common.dao.container_config.vulnerabilities_config module

class csle_common.dao.emulation_config.vulnerabilities_config.VulnerabilitiesConfig(node_vulnerability_configs: List[csle_common.dao.emulation_config.node_vulnerability_config.NodeVulnerabilityConfig])[source]

Bases: csle_base.json_serializable.JSONSerializable

A DTO class representing the vulnerabilities configuration of an emulation environment

copy() csle_common.dao.emulation_config.vulnerabilities_config.VulnerabilitiesConfig[source]
Returns

a copy of the DTO

create_execution_config(ip_first_octet: int) csle_common.dao.emulation_config.vulnerabilities_config.VulnerabilitiesConfig[source]

Creates a new config for an execution

Parameters

ip_first_octet – the first octet of the IP of the new execution

Returns

the new config

static from_dict(d: Dict[str, Any]) csle_common.dao.emulation_config.vulnerabilities_config.VulnerabilitiesConfig[source]

Converts a dict representation of the object to a DTO representation :return: a DTO representation of the object

static from_json_file(json_file_path: str) csle_common.dao.emulation_config.vulnerabilities_config.VulnerabilitiesConfig[source]

Reads a json file and converts it to a DTO

Parameters

json_file_path – the json file path

Returns

the converted DTO

get_vulnerabilities(ips: List[str]) List[csle_common.dao.emulation_config.node_vulnerability_config.NodeVulnerabilityConfig][source]

Gets a list of vulnerabilities for a list of ip addresses

Parameters

ips – the list of ip addresse

Returns

the list of vulnerabilities corresponding to the list of ip addresses

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

Converts the object to a dict representation

Returns

a dict representation of the object

csle_common.dao.container_config.vulnerability_type module

Type of vulnerabilities in an emulation

class csle_common.dao.emulation_config.vulnerability_type.VulnType(value)[source]

Bases: enum.IntEnum

Enum representing the different vulnerability types for generated containers

PRIVILEGE_ESCALATION = 3
RCE = 1
SQL_INJECTION = 2
WEAK_PW = 0

Module contents