diff --git a/src/primaite/config/_package_data/data_manipulation.yaml b/src/primaite/config/_package_data/data_manipulation.yaml index b6899b79..deda5d73 100644 --- a/src/primaite/config/_package_data/data_manipulation.yaml +++ b/src/primaite/config/_package_data/data_manipulation.yaml @@ -226,16 +226,16 @@ agents: label: LINKS options: link_references: - - router_1___switch_1 - - router_1___switch_2 - - switch_1___domain_controller - - switch_1___web_server - - switch_1___database_server - - switch_1___backup_server - - switch_1___security_suite - - switch_2___client_1 - - switch_2___client_2 - - switch_2___security_suite + - router_1:eth-1<->switch_1:eth-8 + - router_1:eth-2<->switch_2:eth-8 + - switch_1:eth-1<->domain_controller:eth-1 + - switch_1:eth-2<->web_server:eth-1 + - switch_1:eth-3<->database_server:eth-1 + - switch_1:eth-4<->backup_server:eth-1 + - switch_1:eth-7<->security_suite:eth-1 + - switch_2:eth-1<->client_1:eth-1 + - switch_2:eth-2<->client_2:eth-1 + - switch_2:eth-7<->security_suite:eth-2 - type: "NONE" label: ICS options: {} @@ -756,8 +756,7 @@ simulation: - DELETE nodes: - - ref: router_1 - hostname: router_1 + - hostname: router_1 type: router num_ports: 5 ports: @@ -792,74 +791,61 @@ simulation: action: PERMIT protocol: ICMP - - ref: switch_1 - hostname: switch_1 + - hostname: switch_1 type: switch num_ports: 8 - - ref: switch_2 - hostname: switch_2 + - hostname: switch_2 type: switch num_ports: 8 - - ref: domain_controller - hostname: domain_controller + - hostname: domain_controller type: server ip_address: 192.168.1.10 subnet_mask: 255.255.255.0 default_gateway: 192.168.1.1 services: - - ref: domain_controller_dns_server - type: DNSServer + - type: DNSServer options: domain_mapping: arcd.com: 192.168.1.12 # web server - - ref: web_server - hostname: web_server + - hostname: web_server type: server ip_address: 192.168.1.12 subnet_mask: 255.255.255.0 default_gateway: 192.168.1.1 dns_server: 192.168.1.10 services: - - ref: web_server_web_service - type: WebServer + - type: WebServer applications: - - ref: web_server_database_client - type: DatabaseClient + - type: DatabaseClient options: db_server_ip: 192.168.1.14 - - ref: database_server - hostname: database_server + - hostname: database_server type: server ip_address: 192.168.1.14 subnet_mask: 255.255.255.0 default_gateway: 192.168.1.1 dns_server: 192.168.1.10 services: - - ref: database_service - type: DatabaseService + - type: DatabaseService options: backup_server_ip: 192.168.1.16 - - ref: database_ftp_client - type: FTPClient + - type: FTPClient - - ref: backup_server - hostname: backup_server + - hostname: backup_server type: server ip_address: 192.168.1.16 subnet_mask: 255.255.255.0 default_gateway: 192.168.1.1 dns_server: 192.168.1.10 services: - - ref: backup_service - type: FTPServer + - type: FTPServer - - ref: security_suite - hostname: security_suite + - hostname: security_suite type: server ip_address: 192.168.1.110 subnet_mask: 255.255.255.0 @@ -870,110 +856,88 @@ simulation: ip_address: 192.168.10.110 subnet_mask: 255.255.255.0 - - ref: client_1 - hostname: client_1 + - hostname: client_1 type: computer ip_address: 192.168.10.21 subnet_mask: 255.255.255.0 default_gateway: 192.168.10.1 dns_server: 192.168.1.10 applications: - - ref: data_manipulation_bot - type: DataManipulationBot + - type: DataManipulationBot options: port_scan_p_of_success: 0.8 data_manipulation_p_of_success: 0.8 payload: "DELETE" server_ip: 192.168.1.14 - - ref: client_1_web_browser - type: WebBrowser + - type: WebBrowser options: target_url: http://arcd.com/users/ - - ref: client_1_database_client - type: DatabaseClient + - type: DatabaseClient options: db_server_ip: 192.168.1.14 services: - - ref: client_1_dns_client - type: DNSClient + - type: DNSClient - - ref: client_2 - hostname: client_2 + - hostname: client_2 type: computer ip_address: 192.168.10.22 subnet_mask: 255.255.255.0 default_gateway: 192.168.10.1 dns_server: 192.168.1.10 applications: - - ref: client_2_web_browser - type: WebBrowser + - type: WebBrowser options: target_url: http://arcd.com/users/ - - ref: data_manipulation_bot - type: DataManipulationBot + - type: DataManipulationBot options: port_scan_p_of_success: 0.8 data_manipulation_p_of_success: 0.8 payload: "DELETE" server_ip: 192.168.1.14 - - ref: client_2_database_client - type: DatabaseClient + - type: DatabaseClient options: db_server_ip: 192.168.1.14 services: - - ref: client_2_dns_client - type: DNSClient - - + - type: DNSClient links: - - ref: router_1___switch_1 - endpoint_a_ref: router_1 + - endpoint_a_hostname: router_1 endpoint_a_port: 1 - endpoint_b_ref: switch_1 + endpoint_b_hostname: switch_1 endpoint_b_port: 8 - - ref: router_1___switch_2 - endpoint_a_ref: router_1 + - endpoint_a_hostname: router_1 endpoint_a_port: 2 - endpoint_b_ref: switch_2 + endpoint_b_hostname: switch_2 endpoint_b_port: 8 - - ref: switch_1___domain_controller - endpoint_a_ref: switch_1 + - endpoint_a_hostname: switch_1 endpoint_a_port: 1 - endpoint_b_ref: domain_controller + endpoint_b_hostname: domain_controller endpoint_b_port: 1 - - ref: switch_1___web_server - endpoint_a_ref: switch_1 + - endpoint_a_hostname: switch_1 endpoint_a_port: 2 - endpoint_b_ref: web_server + endpoint_b_hostname: web_server endpoint_b_port: 1 - - ref: switch_1___database_server - endpoint_a_ref: switch_1 + - endpoint_a_hostname: switch_1 endpoint_a_port: 3 - endpoint_b_ref: database_server + endpoint_b_hostname: database_server endpoint_b_port: 1 - - ref: switch_1___backup_server - endpoint_a_ref: switch_1 + - endpoint_a_hostname: switch_1 endpoint_a_port: 4 - endpoint_b_ref: backup_server + endpoint_b_hostname: backup_server endpoint_b_port: 1 - - ref: switch_1___security_suite - endpoint_a_ref: switch_1 + - endpoint_a_hostname: switch_1 endpoint_a_port: 7 - endpoint_b_ref: security_suite + endpoint_b_hostname: security_suite endpoint_b_port: 1 - - ref: switch_2___client_1 - endpoint_a_ref: switch_2 + - endpoint_a_hostname: switch_2 endpoint_a_port: 1 - endpoint_b_ref: client_1 + endpoint_b_hostname: client_1 endpoint_b_port: 1 - - ref: switch_2___client_2 - endpoint_a_ref: switch_2 + - endpoint_a_hostname: switch_2 endpoint_a_port: 2 - endpoint_b_ref: client_2 + endpoint_b_hostname: client_2 endpoint_b_port: 1 - - ref: switch_2___security_suite - endpoint_a_ref: switch_2 + - endpoint_a_hostname: switch_2 endpoint_a_port: 7 - endpoint_b_ref: security_suite + endpoint_b_hostname: security_suite endpoint_b_port: 2 diff --git a/src/primaite/config/_package_data/data_manipulation_marl.yaml b/src/primaite/config/_package_data/data_manipulation_marl.yaml index 86759b2d..653ddfd3 100644 --- a/src/primaite/config/_package_data/data_manipulation_marl.yaml +++ b/src/primaite/config/_package_data/data_manipulation_marl.yaml @@ -228,16 +228,16 @@ agents: label: LINKS options: link_references: - - router_1___switch_1 - - router_1___switch_2 - - switch_1___domain_controller - - switch_1___web_server - - switch_1___database_server - - switch_1___backup_server - - switch_1___security_suite - - switch_2___client_1 - - switch_2___client_2 - - switch_2___security_suite + - router_1:eth-1<->switch_1:eth-8 + - router_1:eth-2<->switch_2:eth-8 + - switch_1:eth-1<->domain_controller:eth-1 + - switch_1:eth-2<->web_server:eth-1 + - switch_1:eth-3<->database_server:eth-1 + - switch_1:eth-4<->backup_server:eth-1 + - switch_1:eth-7<->security_suite:eth-1 + - switch_2:eth-1<->client_1:eth-1 + - switch_2:eth-2<->client_2:eth-1 + - switch_2:eth-7<->security_suite:eth-2 - type: "NONE" label: ICS options: {} @@ -803,16 +803,16 @@ agents: label: LINKS options: link_references: - - router_1___switch_1 - - router_1___switch_2 - - switch_1___domain_controller - - switch_1___web_server - - switch_1___database_server - - switch_1___backup_server - - switch_1___security_suite - - switch_2___client_1 - - switch_2___client_2 - - switch_2___security_suite + - router_1:eth-1<->switch_1:eth-8 + - router_1:eth-2<->switch_2:eth-8 + - switch_1:eth-1<->domain_controller:eth-1 + - switch_1:eth-2<->web_server:eth-1 + - switch_1:eth-3<->database_server:eth-1 + - switch_1:eth-4<->backup_server:eth-1 + - switch_1:eth-7<->security_suite:eth-1 + - switch_2:eth-1<->client_1:eth-1 + - switch_2:eth-2<->client_2:eth-1 + - switch_2:eth-7<->security_suite:eth-2 - type: "NONE" label: ICS options: {} @@ -1334,8 +1334,7 @@ simulation: - DELETE nodes: - - ref: router_1 - hostname: router_1 + - hostname: router_1 type: router num_ports: 5 ports: @@ -1370,74 +1369,61 @@ simulation: action: PERMIT protocol: ICMP - - ref: switch_1 - hostname: switch_1 + - hostname: switch_1 type: switch num_ports: 8 - - ref: switch_2 - hostname: switch_2 + - hostname: switch_2 type: switch num_ports: 8 - - ref: domain_controller - hostname: domain_controller + - hostname: domain_controller type: server ip_address: 192.168.1.10 subnet_mask: 255.255.255.0 default_gateway: 192.168.1.1 services: - - ref: domain_controller_dns_server - type: DNSServer + - type: DNSServer options: domain_mapping: arcd.com: 192.168.1.12 # web server - - ref: web_server - hostname: web_server + - hostname: web_server type: server ip_address: 192.168.1.12 subnet_mask: 255.255.255.0 default_gateway: 192.168.1.1 dns_server: 192.168.1.10 services: - - ref: web_server_web_service - type: WebServer + - type: WebServer applications: - - ref: web_server_database_client - type: DatabaseClient + - type: DatabaseClient options: db_server_ip: 192.168.1.14 - - ref: database_server - hostname: database_server + - hostname: database_server type: server ip_address: 192.168.1.14 subnet_mask: 255.255.255.0 default_gateway: 192.168.1.1 dns_server: 192.168.1.10 services: - - ref: database_service - type: DatabaseService + - type: DatabaseService options: backup_server_ip: 192.168.1.16 - - ref: database_ftp_client - type: FTPClient + - type: FTPClient - - ref: backup_server - hostname: backup_server + - hostname: backup_server type: server ip_address: 192.168.1.16 subnet_mask: 255.255.255.0 default_gateway: 192.168.1.1 dns_server: 192.168.1.10 services: - - ref: backup_service - type: FTPServer + - type: FTPServer - - ref: security_suite - hostname: security_suite + - hostname: security_suite type: server ip_address: 192.168.1.110 subnet_mask: 255.255.255.0 @@ -1448,110 +1434,90 @@ simulation: ip_address: 192.168.10.110 subnet_mask: 255.255.255.0 - - ref: client_1 - hostname: client_1 + - hostname: client_1 type: computer ip_address: 192.168.10.21 subnet_mask: 255.255.255.0 default_gateway: 192.168.10.1 dns_server: 192.168.1.10 applications: - - ref: data_manipulation_bot - type: DataManipulationBot + - type: DataManipulationBot options: port_scan_p_of_success: 0.8 data_manipulation_p_of_success: 0.8 payload: "DELETE" server_ip: 192.168.1.14 - - ref: client_1_web_browser - type: WebBrowser + - type: WebBrowser options: target_url: http://arcd.com/users/ - - ref: client_1_database_client - type: DatabaseClient + - type: DatabaseClient options: db_server_ip: 192.168.1.14 services: - - ref: client_1_dns_client - type: DNSClient + - type: DNSClient - - ref: client_2 - hostname: client_2 + - hostname: client_2 type: computer ip_address: 192.168.10.22 subnet_mask: 255.255.255.0 default_gateway: 192.168.10.1 dns_server: 192.168.1.10 applications: - - ref: client_2_web_browser - type: WebBrowser + - type: WebBrowser options: target_url: http://arcd.com/users/ - - ref: data_manipulation_bot - type: DataManipulationBot + - type: DataManipulationBot options: port_scan_p_of_success: 0.8 data_manipulation_p_of_success: 0.8 payload: "DELETE" server_ip: 192.168.1.14 - - ref: client_2_database_client - type: DatabaseClient + - type: DatabaseClient options: db_server_ip: 192.168.1.14 services: - - ref: client_2_dns_client - type: DNSClient + - ty DNSClient links: - - ref: router_1___switch_1 - endpoint_a_ref: router_1 + - endpoint_a_hostname: router_1 endpoint_a_port: 1 - endpoint_b_ref: switch_1 + endpoint_b_hostname: switch_1 endpoint_b_port: 8 - - ref: router_1___switch_2 - endpoint_a_ref: router_1 + - endpoint_a_hostname: router_1 endpoint_a_port: 2 - endpoint_b_ref: switch_2 + endpoint_b_hostname: switch_2 endpoint_b_port: 8 - - ref: switch_1___domain_controller - endpoint_a_ref: switch_1 + - endpoint_a_hostname: switch_1 endpoint_a_port: 1 - endpoint_b_ref: domain_controller + endpoint_b_hostname: domain_controller endpoint_b_port: 1 - - ref: switch_1___web_server - endpoint_a_ref: switch_1 + - endpoint_a_hostname: switch_1 endpoint_a_port: 2 - endpoint_b_ref: web_server + endpoint_b_hostname: web_server endpoint_b_port: 1 - - ref: switch_1___database_server - endpoint_a_ref: switch_1 + - endpoint_a_hostname: switch_1 endpoint_a_port: 3 - endpoint_b_ref: database_server + endpoint_b_hostname: database_server endpoint_b_port: 1 - - ref: switch_1___backup_server - endpoint_a_ref: switch_1 + - endpoint_a_hostname: switch_1 endpoint_a_port: 4 - endpoint_b_ref: backup_server + endpoint_b_hostname: backup_server endpoint_b_port: 1 - - ref: switch_1___security_suite - endpoint_a_ref: switch_1 + - endpoint_a_hostname: switch_1 endpoint_a_port: 7 - endpoint_b_ref: security_suite + endpoint_b_hostname: security_suite endpoint_b_port: 1 - - ref: switch_2___client_1 - endpoint_a_ref: switch_2 + - endpoint_a_hostname: switch_2 endpoint_a_port: 1 - endpoint_b_ref: client_1 + endpoint_b_hostname: client_1 endpoint_b_port: 1 - - ref: switch_2___client_2 - endpoint_a_ref: switch_2 + - endpoint_a_hostname: switch_2 endpoint_a_port: 2 - endpoint_b_ref: client_2 + endpoint_b_hostname: client_2 endpoint_b_port: 1 - - ref: switch_2___security_suite - endpoint_a_ref: switch_2 + - endpoint_a_hostname: switch_2 endpoint_a_port: 7 - endpoint_b_ref: security_suite + endpoint_b_hostname: security_suite endpoint_b_port: 2 diff --git a/src/primaite/game/agent/observations/acl_observation.py b/src/primaite/game/agent/observations/acl_observation.py index fc603a8a..934d688e 100644 --- a/src/primaite/game/agent/observations/acl_observation.py +++ b/src/primaite/game/agent/observations/acl_observation.py @@ -1,7 +1,7 @@ from __future__ import annotations from ipaddress import IPv4Address -from typing import Dict, List, Optional, TYPE_CHECKING +from typing import Dict, List, Optional from gymnasium import spaces from gymnasium.core import ObsType @@ -10,8 +10,6 @@ from primaite import getLogger from primaite.game.agent.observations.observations import AbstractObservation, WhereType from primaite.game.agent.utils import access_from_nested_dict, NOT_PRESENT_IN_STATE -if TYPE_CHECKING: - from primaite.game.game import PrimaiteGame _LOGGER = getLogger(__name__) @@ -167,7 +165,7 @@ class ACLObservation(AbstractObservation, identifier="ACL"): ) @classmethod - def from_config(cls, config: ConfigSchema, game: "PrimaiteGame", parent_where: WhereType = []) -> ACLObservation: + def from_config(cls, config: ConfigSchema, parent_where: WhereType = []) -> ACLObservation: """ Create an ACL observation from a configuration schema. diff --git a/src/primaite/game/agent/observations/file_system_observations.py b/src/primaite/game/agent/observations/file_system_observations.py index 3e262055..baf27660 100644 --- a/src/primaite/game/agent/observations/file_system_observations.py +++ b/src/primaite/game/agent/observations/file_system_observations.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import Dict, Iterable, List, Optional, TYPE_CHECKING +from typing import Dict, Iterable, List, Optional from gymnasium import spaces from gymnasium.core import ObsType @@ -9,8 +9,6 @@ from primaite import getLogger from primaite.game.agent.observations.observations import AbstractObservation, WhereType from primaite.game.agent.utils import access_from_nested_dict, NOT_PRESENT_IN_STATE -if TYPE_CHECKING: - from primaite.game.game import PrimaiteGame _LOGGER = getLogger(__name__) @@ -94,7 +92,7 @@ class FileObservation(AbstractObservation, identifier="FILE"): return spaces.Dict(space) @classmethod - def from_config(cls, config: ConfigSchema, game: "PrimaiteGame", parent_where: WhereType = []) -> FileObservation: + def from_config(cls, config: ConfigSchema, parent_where: WhereType = []) -> FileObservation: """ Create a file observation from a configuration schema. @@ -193,7 +191,7 @@ class FolderObservation(AbstractObservation, identifier="FOLDER"): return spaces.Dict(shape) @classmethod - def from_config(cls, config: ConfigSchema, game: "PrimaiteGame", parent_where: WhereType = []) -> FolderObservation: + def from_config(cls, config: ConfigSchema, parent_where: WhereType = []) -> FolderObservation: """ Create a folder observation from a configuration schema. @@ -211,5 +209,5 @@ class FolderObservation(AbstractObservation, identifier="FOLDER"): for file_config in config.files: file_config.include_num_access = config.include_num_access - files = [FileObservation.from_config(config=f, game=game, parent_where=where) for f in config.files] + files = [FileObservation.from_config(config=f, parent_where=where) for f in config.files] return cls(where=where, files=files, num_files=config.num_files, include_num_access=config.include_num_access) diff --git a/src/primaite/game/agent/observations/firewall_observation.py b/src/primaite/game/agent/observations/firewall_observation.py index 0a1498b1..97a8f814 100644 --- a/src/primaite/game/agent/observations/firewall_observation.py +++ b/src/primaite/game/agent/observations/firewall_observation.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import Dict, List, Optional, TYPE_CHECKING +from typing import Dict, List, Optional from gymnasium import spaces from gymnasium.core import ObsType @@ -10,8 +10,6 @@ from primaite.game.agent.observations.acl_observation import ACLObservation from primaite.game.agent.observations.nic_observations import PortObservation from primaite.game.agent.observations.observations import AbstractObservation, WhereType -if TYPE_CHECKING: - from primaite.game.game import PrimaiteGame _LOGGER = getLogger(__name__) @@ -200,9 +198,7 @@ class FirewallObservation(AbstractObservation, identifier="FIREWALL"): return space @classmethod - def from_config( - cls, config: ConfigSchema, game: "PrimaiteGame", parent_where: WhereType = [] - ) -> FirewallObservation: + def from_config(cls, config: ConfigSchema, parent_where: WhereType = []) -> FirewallObservation: """ Create a firewall observation from a configuration schema. diff --git a/src/primaite/game/agent/observations/host_observations.py b/src/primaite/game/agent/observations/host_observations.py index 6dbde789..b15ede9a 100644 --- a/src/primaite/game/agent/observations/host_observations.py +++ b/src/primaite/game/agent/observations/host_observations.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import Dict, List, Optional, TYPE_CHECKING +from typing import Dict, List, Optional from gymnasium import spaces from gymnasium.core import ObsType @@ -12,8 +12,6 @@ from primaite.game.agent.observations.observations import AbstractObservation, W from primaite.game.agent.observations.software_observation import ApplicationObservation, ServiceObservation from primaite.game.agent.utils import access_from_nested_dict, NOT_PRESENT_IN_STATE -if TYPE_CHECKING: - from primaite.game.game import PrimaiteGame _LOGGER = getLogger(__name__) @@ -201,7 +199,7 @@ class HostObservation(AbstractObservation, identifier="HOST"): return spaces.Dict(shape) @classmethod - def from_config(cls, config: ConfigSchema, game: "PrimaiteGame", parent_where: WhereType = []) -> HostObservation: + def from_config(cls, config: ConfigSchema, parent_where: WhereType = []) -> HostObservation: """ Create a host observation from a configuration schema. @@ -225,12 +223,10 @@ class HostObservation(AbstractObservation, identifier="HOST"): for nic_config in config.network_interfaces: nic_config.include_nmne = config.include_nmne - services = [ServiceObservation.from_config(config=c, game=game, parent_where=where) for c in config.services] - applications = [ - ApplicationObservation.from_config(config=c, game=game, parent_where=where) for c in config.applications - ] - folders = [FolderObservation.from_config(config=c, game=game, parent_where=where) for c in config.folders] - nics = [NICObservation.from_config(config=c, game=game, parent_where=where) for c in config.network_interfaces] + services = [ServiceObservation.from_config(config=c, parent_where=where) for c in config.services] + applications = [ApplicationObservation.from_config(config=c, parent_where=where) for c in config.applications] + folders = [FolderObservation.from_config(config=c, parent_where=where) for c in config.folders] + nics = [NICObservation.from_config(config=c, parent_where=where) for c in config.network_interfaces] return cls( where=where, diff --git a/src/primaite/game/agent/observations/link_observation.py b/src/primaite/game/agent/observations/link_observation.py index be08657d..03a19fa0 100644 --- a/src/primaite/game/agent/observations/link_observation.py +++ b/src/primaite/game/agent/observations/link_observation.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import Any, Dict, List, TYPE_CHECKING +from typing import Any, Dict, List from gymnasium import spaces from gymnasium.core import ObsType @@ -9,8 +9,6 @@ from primaite import getLogger from primaite.game.agent.observations.observations import AbstractObservation, WhereType from primaite.game.agent.utils import access_from_nested_dict, NOT_PRESENT_IN_STATE -if TYPE_CHECKING: - from primaite.game.game import PrimaiteGame _LOGGER = getLogger(__name__) @@ -68,21 +66,19 @@ class LinkObservation(AbstractObservation, identifier="LINK"): return spaces.Dict({"PROTOCOLS": spaces.Dict({"ALL": spaces.Discrete(11)})}) @classmethod - def from_config(cls, config: ConfigSchema, game: "PrimaiteGame", parent_where: WhereType = []) -> LinkObservation: + def from_config(cls, config: ConfigSchema, parent_where: WhereType = []) -> LinkObservation: """ Create a link observation from a configuration schema. :param config: Configuration schema containing the necessary information for the link observation. :type config: ConfigSchema - :param game: The PrimaiteGame instance. - :type game: PrimaiteGame :param parent_where: Where in the simulation state dictionary to find the information about this link. A typical location might be ['network', 'links', ]. :type parent_where: WhereType, optional :return: Constructed link observation instance. :rtype: LinkObservation """ - link_reference = game.ref_map_links[config.link_reference] + link_reference = config.link_reference if parent_where == []: where = ["network", "links", link_reference] else: @@ -135,14 +131,12 @@ class LinksObservation(AbstractObservation, identifier="LINKS"): return spaces.Dict({i + 1: l.space for i, l in enumerate(self.links)}) @classmethod - def from_config(cls, config: ConfigSchema, game: "PrimaiteGame", parent_where: WhereType = []) -> LinksObservation: + def from_config(cls, config: ConfigSchema, parent_where: WhereType = []) -> LinksObservation: """ Create a links observation from a configuration schema. :param config: Configuration schema containing the necessary information for the links observation. :type config: ConfigSchema - :param game: The PrimaiteGame instance. - :type game: PrimaiteGame :param parent_where: Where in the simulation state dictionary to find the information about these links. A typical location might be ['network']. :type parent_where: WhereType, optional @@ -151,5 +145,5 @@ class LinksObservation(AbstractObservation, identifier="LINKS"): """ where = parent_where + ["network"] link_cfgs = [LinkObservation.ConfigSchema(link_reference=ref) for ref in config.link_references] - links = [LinkObservation.from_config(c, game=game, parent_where=where) for c in link_cfgs] + links = [LinkObservation.from_config(c, parent_where=where) for c in link_cfgs] return cls(where=where, links=links) diff --git a/src/primaite/game/agent/observations/nic_observations.py b/src/primaite/game/agent/observations/nic_observations.py index 44cc7f8f..afce9095 100644 --- a/src/primaite/game/agent/observations/nic_observations.py +++ b/src/primaite/game/agent/observations/nic_observations.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import Dict, Optional, TYPE_CHECKING +from typing import Dict, Optional from gymnasium import spaces from gymnasium.core import ObsType @@ -8,9 +8,6 @@ from gymnasium.core import ObsType from primaite.game.agent.observations.observations import AbstractObservation, WhereType from primaite.game.agent.utils import access_from_nested_dict, NOT_PRESENT_IN_STATE -if TYPE_CHECKING: - from primaite.game.game import PrimaiteGame - class NICObservation(AbstractObservation, identifier="NETWORK_INTERFACE"): """Status information about a network interface within the simulation environment.""" @@ -119,7 +116,7 @@ class NICObservation(AbstractObservation, identifier="NETWORK_INTERFACE"): return space @classmethod - def from_config(cls, config: ConfigSchema, game: "PrimaiteGame", parent_where: WhereType = []) -> NICObservation: + def from_config(cls, config: ConfigSchema, parent_where: WhereType = []) -> NICObservation: """ Create a network interface observation from a configuration schema. @@ -179,7 +176,7 @@ class PortObservation(AbstractObservation, identifier="PORT"): return spaces.Dict({"operating_status": spaces.Discrete(3)}) @classmethod - def from_config(cls, config: ConfigSchema, game: "PrimaiteGame", parent_where: WhereType = []) -> PortObservation: + def from_config(cls, config: ConfigSchema, parent_where: WhereType = []) -> PortObservation: """ Create a port observation from a configuration schema. diff --git a/src/primaite/game/agent/observations/node_observations.py b/src/primaite/game/agent/observations/node_observations.py index f11ffebf..8f7ac0fc 100644 --- a/src/primaite/game/agent/observations/node_observations.py +++ b/src/primaite/game/agent/observations/node_observations.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import Dict, List, Optional, TYPE_CHECKING +from typing import Dict, List, Optional from gymnasium import spaces from gymnasium.core import ObsType @@ -12,8 +12,6 @@ from primaite.game.agent.observations.host_observations import HostObservation from primaite.game.agent.observations.observations import AbstractObservation, WhereType from primaite.game.agent.observations.router_observation import RouterObservation -if TYPE_CHECKING: - from primaite.game.game import PrimaiteGame _LOGGER = getLogger(__name__) @@ -152,7 +150,7 @@ class NodesObservation(AbstractObservation, identifier="NODES"): return space @classmethod - def from_config(cls, config: ConfigSchema, game: "PrimaiteGame", parent_where: WhereType = []) -> NodesObservation: + def from_config(cls, config: ConfigSchema, parent_where: WhereType = []) -> NodesObservation: """ Create a nodes observation from a configuration schema. @@ -211,8 +209,8 @@ class NodesObservation(AbstractObservation, identifier="NODES"): if firewall_config.num_rules is None: firewall_config.num_rules = config.num_rules - hosts = [HostObservation.from_config(config=c, game=game, parent_where=where) for c in config.hosts] - routers = [RouterObservation.from_config(config=c, game=game, parent_where=where) for c in config.routers] - firewalls = [FirewallObservation.from_config(config=c, game=game, parent_where=where) for c in config.firewalls] + hosts = [HostObservation.from_config(config=c, parent_where=where) for c in config.hosts] + routers = [RouterObservation.from_config(config=c, parent_where=where) for c in config.routers] + firewalls = [FirewallObservation.from_config(config=c, parent_where=where) for c in config.firewalls] return cls(where=where, hosts=hosts, routers=routers, firewalls=firewalls) diff --git a/src/primaite/game/agent/observations/observation_manager.py b/src/primaite/game/agent/observations/observation_manager.py index 1d428fa8..047acce6 100644 --- a/src/primaite/game/agent/observations/observation_manager.py +++ b/src/primaite/game/agent/observations/observation_manager.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import Any, Dict, List, Optional, TYPE_CHECKING +from typing import Any, Dict, List, Optional from gymnasium import spaces from gymnasium.core import ObsType @@ -8,9 +8,6 @@ from pydantic import BaseModel, ConfigDict, model_validator, ValidationError from primaite.game.agent.observations.observations import AbstractObservation, WhereType -if TYPE_CHECKING: - from primaite.game.game import PrimaiteGame - class NestedObservation(AbstractObservation, identifier="CUSTOM"): """Observation type that allows combining other observations into a gymnasium.spaces.Dict space.""" @@ -76,7 +73,7 @@ class NestedObservation(AbstractObservation, identifier="CUSTOM"): return spaces.Dict({label: obs.space for label, obs in self.components.items()}) @classmethod - def from_config(cls, config: ConfigSchema, game: "PrimaiteGame", parent_where: WhereType = []) -> NestedObservation: + def from_config(cls, config: ConfigSchema, parent_where: WhereType = []) -> NestedObservation: """ Read the Nested observation config and create all defined subcomponents. @@ -115,7 +112,7 @@ class NestedObservation(AbstractObservation, identifier="CUSTOM"): instances = dict() for component in config.components: obs_class = AbstractObservation._registry[component.type] - obs_instance = obs_class.from_config(config=obs_class.ConfigSchema(**component.options), game=game) + obs_instance = obs_class.from_config(config=obs_class.ConfigSchema(**component.options)) instances[component.label] = obs_instance return cls(components=instances) @@ -137,9 +134,7 @@ class NullObservation(AbstractObservation, identifier="NONE"): return spaces.Discrete(1) @classmethod - def from_config( - cls, config: NullObservation.ConfigSchema, game: "PrimaiteGame", parent_where: WhereType = [] - ) -> NullObservation: + def from_config(cls, config: NullObservation.ConfigSchema, parent_where: WhereType = []) -> NullObservation: """Instantiate a NullObservation. Accepts parameters to comply with API.""" return cls() @@ -180,7 +175,7 @@ class ObservationManager: return self.obs.space @classmethod - def from_config(cls, config: Optional[Dict], game: "PrimaiteGame") -> "ObservationManager": + def from_config(cls, config: Optional[Dict]) -> "ObservationManager": """ Create observation space from a config. @@ -191,14 +186,12 @@ class ObservationManager: AbstractObservation options: this must adhere to the chosen observation type's ConfigSchema nested class. :type config: Dict - :param game: Reference to the PrimaiteGame object that spawned this observation. - :type game: PrimaiteGame """ if config is None: return cls(NullObservation()) print(config) obs_type = config["type"] obs_class = AbstractObservation._registry[obs_type] - observation = obs_class.from_config(config=obs_class.ConfigSchema(**config["options"]), game=game) + observation = obs_class.from_config(config=obs_class.ConfigSchema(**config["options"])) obs_manager = cls(observation) return obs_manager diff --git a/src/primaite/game/agent/observations/observations.py b/src/primaite/game/agent/observations/observations.py index 6c9db571..0d6ff2a3 100644 --- a/src/primaite/game/agent/observations/observations.py +++ b/src/primaite/game/agent/observations/observations.py @@ -1,6 +1,6 @@ """Manages the observation space for the agent.""" from abc import ABC, abstractmethod -from typing import Any, Dict, Iterable, Type, TYPE_CHECKING +from typing import Any, Dict, Iterable, Type from gymnasium import spaces from gymnasium.core import ObsType @@ -8,8 +8,6 @@ from pydantic import BaseModel, ConfigDict from primaite import getLogger -if TYPE_CHECKING: - from primaite.game.game import PrimaiteGame _LOGGER = getLogger(__name__) WhereType = Iterable[str | int] | None @@ -65,8 +63,6 @@ class AbstractObservation(ABC): @classmethod @abstractmethod - def from_config( - cls, config: ConfigSchema, game: "PrimaiteGame", parent_where: WhereType = [] - ) -> "AbstractObservation": + def from_config(cls, config: ConfigSchema, parent_where: WhereType = []) -> "AbstractObservation": """Create this observation space component form a serialised format.""" return cls() diff --git a/src/primaite/game/agent/observations/router_observation.py b/src/primaite/game/agent/observations/router_observation.py index aeac2766..3f7e6494 100644 --- a/src/primaite/game/agent/observations/router_observation.py +++ b/src/primaite/game/agent/observations/router_observation.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import Dict, List, Optional, TYPE_CHECKING +from typing import Dict, List, Optional from gymnasium import spaces from gymnasium.core import ObsType @@ -11,8 +11,6 @@ from primaite.game.agent.observations.nic_observations import PortObservation from primaite.game.agent.observations.observations import AbstractObservation, WhereType from primaite.game.agent.utils import access_from_nested_dict, NOT_PRESENT_IN_STATE -if TYPE_CHECKING: - from primaite.game.game import PrimaiteGame _LOGGER = getLogger(__name__) @@ -112,7 +110,7 @@ class RouterObservation(AbstractObservation, identifier="ROUTER"): return spaces.Dict(shape) @classmethod - def from_config(cls, config: ConfigSchema, game: "PrimaiteGame", parent_where: WhereType = []) -> RouterObservation: + def from_config(cls, config: ConfigSchema, parent_where: WhereType = []) -> RouterObservation: """ Create a router observation from a configuration schema. @@ -142,6 +140,6 @@ class RouterObservation(AbstractObservation, identifier="ROUTER"): if config.ports is None: config.ports = [PortObservation.ConfigSchema(port_id=i + 1) for i in range(config.num_ports)] - ports = [PortObservation.from_config(config=c, game=game, parent_where=where) for c in config.ports] - acl = ACLObservation.from_config(config=config.acl, game=game, parent_where=where) + ports = [PortObservation.from_config(config=c, parent_where=where) for c in config.ports] + acl = ACLObservation.from_config(config=config.acl, parent_where=where) return cls(where=where, ports=ports, num_ports=config.num_ports, acl=acl) diff --git a/src/primaite/game/agent/observations/software_observation.py b/src/primaite/game/agent/observations/software_observation.py index 2c4806d9..f943f540 100644 --- a/src/primaite/game/agent/observations/software_observation.py +++ b/src/primaite/game/agent/observations/software_observation.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import Dict, TYPE_CHECKING +from typing import Dict from gymnasium import spaces from gymnasium.core import ObsType @@ -8,9 +8,6 @@ from gymnasium.core import ObsType from primaite.game.agent.observations.observations import AbstractObservation, WhereType from primaite.game.agent.utils import access_from_nested_dict, NOT_PRESENT_IN_STATE -if TYPE_CHECKING: - from primaite.game.game import PrimaiteGame - class ServiceObservation(AbstractObservation, identifier="SERVICE"): """Service observation, shows status of a service in the simulation environment.""" @@ -60,9 +57,7 @@ class ServiceObservation(AbstractObservation, identifier="SERVICE"): return spaces.Dict({"operating_status": spaces.Discrete(7), "health_status": spaces.Discrete(5)}) @classmethod - def from_config( - cls, config: ConfigSchema, game: "PrimaiteGame", parent_where: WhereType = [] - ) -> ServiceObservation: + def from_config(cls, config: ConfigSchema, parent_where: WhereType = []) -> ServiceObservation: """ Create a service observation from a configuration schema. @@ -153,9 +148,7 @@ class ApplicationObservation(AbstractObservation, identifier="APPLICATION"): ) @classmethod - def from_config( - cls, config: ConfigSchema, game: "PrimaiteGame", parent_where: WhereType = [] - ) -> ApplicationObservation: + def from_config(cls, config: ConfigSchema, parent_where: WhereType = []) -> ApplicationObservation: """ Create an application observation from a configuration schema. diff --git a/src/primaite/game/game.py b/src/primaite/game/game.py index 6ba7e63c..f069433e 100644 --- a/src/primaite/game/game.py +++ b/src/primaite/game/game.py @@ -102,18 +102,6 @@ class PrimaiteGame: self.options: PrimaiteGameOptions """Special options that apply for the entire game.""" - self.ref_map_nodes: Dict[str, str] = {} - """Mapping from unique node reference name to node object. Used when parsing config files.""" - - self.ref_map_services: Dict[str, str] = {} - """Mapping from human-readable service reference to service object. Used for parsing config files.""" - - self.ref_map_applications: Dict[str, str] = {} - """Mapping from human-readable application reference to application object. Used for parsing config files.""" - - self.ref_map_links: Dict[str, str] = {} - """Mapping from human-readable link reference to link object. Used when parsing config files.""" - self.save_step_metadata: bool = False """Whether to save the RL agents' action, environment state, and other data at every single step.""" @@ -238,7 +226,6 @@ class PrimaiteGame: links_cfg = network_config.get("links", []) for node_cfg in nodes_cfg: - node_ref = node_cfg["ref"] n_type = node_cfg["type"] if n_type == "computer": new_node = Computer( @@ -289,13 +276,11 @@ class PrimaiteGame: if "services" in node_cfg: for service_cfg in node_cfg["services"]: new_service = None - service_ref = service_cfg["ref"] service_type = service_cfg["type"] if service_type in SERVICE_TYPES_MAPPING: _LOGGER.debug(f"installing {service_type} on node {new_node.hostname}") new_node.software_manager.install(SERVICE_TYPES_MAPPING[service_type]) new_service = new_node.software_manager.software[service_type] - game.ref_map_services[service_ref] = new_service.uuid # start the service new_service.start() @@ -331,13 +316,11 @@ class PrimaiteGame: if "applications" in node_cfg: for application_cfg in node_cfg["applications"]: new_application = None - application_ref = application_cfg["ref"] application_type = application_cfg["type"] if application_type in APPLICATION_TYPES_MAPPING: new_node.software_manager.install(APPLICATION_TYPES_MAPPING[application_type]) new_application = new_node.software_manager.software[application_type] - game.ref_map_applications[application_ref] = new_application.uuid else: msg = f"Configuration contains an invalid application type: {application_type}" _LOGGER.error(msg) @@ -391,7 +374,6 @@ class PrimaiteGame: # run through the power on step if the node is to be turned on at the start if new_node.operating_state == NodeOperatingState.ON: new_node.power_on() - game.ref_map_nodes[node_ref] = new_node.uuid # set start up and shut down duration new_node.start_up_duration = int(node_cfg.get("start_up_duration", 3)) @@ -399,8 +381,8 @@ class PrimaiteGame: # 2. create links between nodes for link_cfg in links_cfg: - node_a = net.nodes[game.ref_map_nodes[link_cfg["endpoint_a_ref"]]] - node_b = net.nodes[game.ref_map_nodes[link_cfg["endpoint_b_ref"]]] + node_a = net.get_node_by_hostname(link_cfg["endpoint_a_hostname"]) + node_b = net.get_node_by_hostname(link_cfg["endpoint_b_hostname"]) if isinstance(node_a, Switch): endpoint_a = node_a.network_interface[link_cfg["endpoint_a_port"]] else: @@ -409,8 +391,7 @@ class PrimaiteGame: endpoint_b = node_b.network_interface[link_cfg["endpoint_b_port"]] else: endpoint_b = node_b.network_interface[link_cfg["endpoint_b_port"]] - new_link = net.connect(endpoint_a=endpoint_a, endpoint_b=endpoint_b) - game.ref_map_links[link_cfg["ref"]] = new_link.uuid + net.connect(endpoint_a=endpoint_a, endpoint_b=endpoint_b) # 3. create agents agents_cfg = cfg.get("agents", []) @@ -423,7 +404,7 @@ class PrimaiteGame: reward_function_cfg = agent_cfg["reward_function"] # CREATE OBSERVATION SPACE - obs_space = ObservationManager.from_config(observation_space_cfg, game) + obs_space = ObservationManager.from_config(observation_space_cfg) # CREATE ACTION SPACE action_space = ActionManager.from_config(game, action_space_cfg) diff --git a/src/primaite/simulator/network/container.py b/src/primaite/simulator/network/container.py index 92ee9f0d..cfe66d89 100644 --- a/src/primaite/simulator/network/container.py +++ b/src/primaite/simulator/network/container.py @@ -225,18 +225,19 @@ class Network(SimComponent): } ) # Update the links one-by-one. The key is a 4-tuple of `hostname_a, port_a, hostname_b, port_b` - for uuid, link in self.links.items(): + for _, link in self.links.items(): node_a = link.endpoint_a._connected_node node_b = link.endpoint_b._connected_node hostname_a = node_a.hostname if node_a else None hostname_b = node_b.hostname if node_b else None port_a = link.endpoint_a.port_num port_b = link.endpoint_b.port_num - state["links"][uuid] = link.describe_state() - state["links"][uuid]["hostname_a"] = hostname_a - state["links"][uuid]["hostname_b"] = hostname_b - state["links"][uuid]["port_a"] = port_a - state["links"][uuid]["port_b"] = port_b + link_key = f"{hostname_a}:eth-{port_a}<->{hostname_b}:eth-{port_b}" + state["links"][link_key] = link.describe_state() + state["links"][link_key]["hostname_a"] = hostname_a + state["links"][link_key]["hostname_b"] = hostname_b + state["links"][link_key]["port_a"] = port_a + state["links"][link_key]["port_b"] = port_b return state diff --git a/tests/assets/configs/bad_primaite_session.yaml b/tests/assets/configs/bad_primaite_session.yaml index d07a0376..7d85ea9f 100644 --- a/tests/assets/configs/bad_primaite_session.yaml +++ b/tests/assets/configs/bad_primaite_session.yaml @@ -136,16 +136,16 @@ agents: label: LINKS options: link_references: - - router_1___switch_1 - - router_1___switch_2 - - switch_1___domain_controller - - switch_1___web_server - - switch_1___database_server - - switch_1___backup_server - - switch_1___security_suite - - switch_2___client_1 - - switch_2___client_2 - - switch_2___security_suite + - router_1:eth-1<->switch_1:eth-8 + - router_1:eth-2<->switch_2:eth-8 + - switch_1:eth-1<->domain_controller:eth-1 + - switch_1:eth-2<->web_server:eth-1 + - switch_1:eth-3<->database_server:eth-1 + - switch_1:eth-4<->backup_server:eth-1 + - switch_1:eth-7<->security_suite:eth-1 + - switch_2:eth-1<->client_1:eth-1 + - switch_2:eth-2<->client_2:eth-1 + - switch_2:eth-7<->security_suite:eth-2 - type: "NONE" label: ICS options: {} @@ -551,8 +551,7 @@ simulation: network: nodes: - - ref: router_1 - type: router + - type: router hostname: router_1 num_ports: 5 ports: @@ -579,70 +578,58 @@ simulation: action: PERMIT protocol: ICMP - - ref: switch_1 - type: switch + - type: switch hostname: switch_1 num_ports: 8 - - ref: switch_2 - type: switch + - type: switch hostname: switch_2 num_ports: 8 - - ref: domain_controller - type: server + - type: server hostname: domain_controller ip_address: 192.168.1.10 subnet_mask: 255.255.255.0 default_gateway: 192.168.1.1 services: - - ref: domain_controller_dns_server - type: DNSServer + - type: DNSServer options: domain_mapping: arcd.com: 192.168.1.12 # web server - - ref: web_server - type: server + - type: server hostname: web_server ip_address: 192.168.1.12 subnet_mask: 255.255.255.0 default_gateway: 192.168.1.1 dns_server: 192.168.1.10 services: - - ref: web_server_web_service - type: WebServer + - type: WebServer applications: - - ref: web_server_database_client - type: DatabaseClient + - type: DatabaseClient options: db_server_ip: 192.168.1.14 - - ref: database_server - type: server + - type: server hostname: database_server ip_address: 192.168.1.14 subnet_mask: 255.255.255.0 default_gateway: 192.168.1.1 dns_server: 192.168.1.10 services: - - ref: database_service - type: DatabaseService + - type: DatabaseService - - ref: backup_server - type: server + - type: server hostname: backup_server ip_address: 192.168.1.16 subnet_mask: 255.255.255.0 default_gateway: 192.168.1.1 dns_server: 192.168.1.10 services: - - ref: backup_service - type: FTPServer + - type: FTPServer - - ref: security_suite - type: server + - type: server hostname: security_suite ip_address: 192.168.1.110 subnet_mask: 255.255.255.0 @@ -653,87 +640,71 @@ simulation: ip_address: 192.168.10.110 subnet_mask: 255.255.255.0 - - ref: client_1 - type: computer + - type: computer hostname: client_1 ip_address: 192.168.10.21 subnet_mask: 255.255.255.0 default_gateway: 192.168.10.1 dns_server: 192.168.1.10 applications: - - ref: data_manipulation_bot - type: DataManipulationBot + - type: DataManipulationBot options: port_scan_p_of_success: 0.1 data_manipulation_p_of_success: 0.1 payload: "DELETE" server_ip: 192.168.1.14 services: - - ref: client_1_dns_client - type: DNSClient + - type: DNSClient - - ref: client_2 - type: computer + - type: computer hostname: client_2 ip_address: 192.168.10.22 subnet_mask: 255.255.255.0 default_gateway: 192.168.10.1 dns_server: 192.168.1.10 applications: - - ref: client_2_web_browser - type: WebBrowser + - type: WebBrowser services: - - ref: client_2_dns_client - type: DNSClient + - type: DNSClient links: - - ref: router_1___switch_1 - endpoint_a_ref: router_1 + - endpoint_a_hostname: router_1 endpoint_a_port: 1 - endpoint_b_ref: switch_1 + endpoint_b_hostname: switch_1 endpoint_b_port: 8 - - ref: router_1___switch_2 - endpoint_a_ref: router_1 + - endpoint_a_hostname: router_1 endpoint_a_port: 2 - endpoint_b_ref: switch_2 + endpoint_b_hostname: switch_2 endpoint_b_port: 8 - - ref: switch_1___domain_controller - endpoint_a_ref: switch_1 + - endpoint_a_hostname: switch_1 endpoint_a_port: 1 - endpoint_b_ref: domain_controller + endpoint_b_hostname: domain_controller endpoint_b_port: 1 - - ref: switch_1___web_server - endpoint_a_ref: switch_1 + - endpoint_a_hostname: switch_1 endpoint_a_port: 2 - endpoint_b_ref: web_server + endpoint_b_hostname: web_server endpoint_b_port: 1 - - ref: switch_1___database_server - endpoint_a_ref: switch_1 + - endpoint_a_hostname: switch_1 endpoint_a_port: 3 - endpoint_b_ref: database_server + endpoint_b_hostname: database_server endpoint_b_port: 1 - - ref: switch_1___backup_server - endpoint_a_ref: switch_1 + - endpoint_a_hostname: switch_1 endpoint_a_port: 4 - endpoint_b_ref: backup_server + endpoint_b_hostname: backup_server endpoint_b_port: 1 - - ref: switch_1___security_suite - endpoint_a_ref: switch_1 + - endpoint_a_hostname: switch_1 endpoint_a_port: 7 - endpoint_b_ref: security_suite + endpoint_b_hostname: security_suite endpoint_b_port: 1 - - ref: switch_2___client_1 - endpoint_a_ref: switch_2 + - endpoint_a_hostname: switch_2 endpoint_a_port: 1 - endpoint_b_ref: client_1 + endpoint_b_hostname: client_1 endpoint_b_port: 1 - - ref: switch_2___client_2 - endpoint_a_ref: switch_2 + - endpoint_a_hostname: switch_2 endpoint_a_port: 2 - endpoint_b_ref: client_2 + endpoint_b_hostname: client_2 endpoint_b_port: 1 - - ref: switch_2___security_suite - endpoint_a_ref: switch_2 + - endpoint_a_hostname: switch_2 endpoint_a_port: 7 - endpoint_b_ref: security_suite + endpoint_b_hostname: security_suite endpoint_b_port: 2 diff --git a/tests/assets/configs/basic_firewall.yaml b/tests/assets/configs/basic_firewall.yaml index da293167..0512fbe1 100644 --- a/tests/assets/configs/basic_firewall.yaml +++ b/tests/assets/configs/basic_firewall.yaml @@ -79,8 +79,7 @@ simulation: network: nodes: - - ref: firewall - type: firewall + - type: firewall hostname: firewall start_up_duration: 0 shut_down_duration: 0 @@ -133,25 +132,21 @@ simulation: action: PERMIT protocol: ICMP - - ref: switch_1 - type: switch + - type: switch hostname: switch_1 num_ports: 8 - - ref: switch_2 - type: switch + - type: switch hostname: switch_2 num_ports: 8 - - ref: client_1 - type: computer + - type: computer hostname: client_1 ip_address: 192.168.10.21 subnet_mask: 255.255.255.0 default_gateway: 192.168.10.1 dns_server: 192.168.1.10 # pre installed services and applications - - ref: client_2 - type: computer + - type: computer hostname: client_2 ip_address: 192.168.10.22 subnet_mask: 255.255.255.0 @@ -160,23 +155,19 @@ simulation: # pre installed services and applications links: - - ref: switch_1___client_1 - endpoint_a_ref: switch_1 + - endpoint_a_hostname: switch_1 endpoint_a_port: 1 - endpoint_b_ref: client_1 + endpoint_b_hostname: client_1 endpoint_b_port: 1 - - ref: switch_2___client_2 - endpoint_a_ref: switch_2 + - endpoint_a_hostname: switch_2 endpoint_a_port: 1 - endpoint_b_ref: client_2 + endpoint_b_hostname: client_2 endpoint_b_port: 1 - - ref: switch_1___firewall - endpoint_a_ref: switch_1 + - endpoint_a_hostname: switch_1 endpoint_a_port: 2 - endpoint_b_ref: firewall + endpoint_b_hostname: firewall endpoint_b_port: 1 - - ref: switch_2___firewall - endpoint_a_ref: switch_2 + - endpoint_a_hostname: switch_2 endpoint_a_port: 2 - endpoint_b_ref: firewall + endpoint_b_hostname: firewall endpoint_b_port: 2 diff --git a/tests/assets/configs/basic_switched_network.yaml b/tests/assets/configs/basic_switched_network.yaml index 9dfeae06..bbc45de2 100644 --- a/tests/assets/configs/basic_switched_network.yaml +++ b/tests/assets/configs/basic_switched_network.yaml @@ -79,79 +79,64 @@ simulation: network: nodes: - - ref: switch_1 - type: switch + - type: switch hostname: switch_1 num_ports: 8 - - ref: client_1 + - hostname: client_1 type: computer - hostname: client_1 ip_address: 192.168.10.21 subnet_mask: 255.255.255.0 default_gateway: 192.168.10.1 dns_server: 192.168.1.10 applications: - - ref: client_1_web_browser - type: WebBrowser + - type: WebBrowser options: target_url: http://arcd.com/users/ - - ref: client_1_database_client - type: DatabaseClient + - type: DatabaseClient options: db_server_ip: 192.168.1.10 server_password: arcd - - ref: data_manipulation_bot - type: DataManipulationBot + - type: DataManipulationBot options: port_scan_p_of_success: 0.8 data_manipulation_p_of_success: 0.8 payload: "DELETE" server_ip: 192.168.1.21 server_password: arcd - - ref: dos_bot - type: DoSBot + - type: DoSBot options: target_ip_address: 192.168.10.21 payload: SPOOF DATA port_scan_p_of_success: 0.8 services: - - ref: client_1_dns_client - type: DNSClient + - type: DNSClient options: dns_server: 192.168.1.10 - - ref: client_1_dns_server - type: DNSServer + - type: DNSServer options: domain_mapping: arcd.com: 192.168.1.10 - - ref: client_1_database_service - type: DatabaseService + - type: DatabaseService options: backup_server_ip: 192.168.1.10 - - ref: client_1_web_service - type: WebServer - - ref: client_1_ftp_server - type: FTPServer + - type: WebServer + - type: FTPServer options: server_password: arcd - - ref: client_1_ntp_client - type: NTPClient + - type: NTPClient options: ntp_server_ip: 192.168.1.10 - - ref: client_1_ntp_server - type: NTPServer - - ref: client_2 + - type: NTPServer + - hostname: client_2 type: computer - hostname: client_2 ip_address: 192.168.10.22 subnet_mask: 255.255.255.0 default_gateway: 192.168.10.1 dns_server: 192.168.1.10 # pre installed services and applications - - ref: client_3 + - hostname: client_3 type: computer - hostname: client_3 ip_address: 192.168.10.23 subnet_mask: 255.255.255.0 default_gateway: 192.168.10.1 @@ -162,13 +147,11 @@ simulation: # pre installed services and applications links: - - ref: switch_1___client_1 - endpoint_a_ref: switch_1 + - endpoint_a_hostname: switch_1 endpoint_a_port: 1 - endpoint_b_ref: client_1 + endpoint_b_hostname: client_1 endpoint_b_port: 1 - - ref: switch_1___client_2 - endpoint_a_ref: switch_1 + - endpoint_a_hostname: switch_1 endpoint_a_port: 2 - endpoint_b_ref: client_2 + endpoint_b_hostname: client_2 endpoint_b_port: 1 diff --git a/tests/assets/configs/dmz_network.yaml b/tests/assets/configs/dmz_network.yaml index acac301a..2ce722f7 100644 --- a/tests/assets/configs/dmz_network.yaml +++ b/tests/assets/configs/dmz_network.yaml @@ -104,8 +104,7 @@ agents: simulation: network: nodes: - - ref: client_1 - type: computer + - type: computer hostname: client_1 ip_address: 192.168.0.10 subnet_mask: 255.255.255.0 @@ -114,15 +113,13 @@ simulation: start_up_duration: 0 shut_down_duration: 0 - - ref: switch_1 - type: switch + - type: switch hostname: switch_1 num_ports: 8 start_up_duration: 0 shut_down_duration: 0 - - ref: router_1 - type: router + - type: router hostname: router_1 num_ports: 5 start_up_duration: 0 @@ -156,8 +153,7 @@ simulation: next_hop_ip_address: 192.168.1.2 metric: 0 - - ref: dmz_server - type: server + - type: server hostname: dmz_server ip_address: 192.168.10.10 subnet_mask: 255.255.255.0 @@ -166,15 +162,13 @@ simulation: start_up_duration: 0 shut_down_duration: 0 - - ref: switch_2 - type: switch + - type: switch hostname: switch_2 num_ports: 8 start_up_duration: 0 shut_down_duration: 0 - - ref: firewall - type: firewall + - type: firewall hostname: firewall start_up_duration: 0 shut_down_duration: 0 @@ -237,15 +231,13 @@ simulation: next_hop_ip_address: 192.168.1.1 metric: 0 - - ref: switch_3 - type: switch + - type: switch hostname: switch_3 num_ports: 8 start_up_duration: 0 shut_down_duration: 0 - - ref: external_computer - type: computer + - type: computer hostname: external_computer ip_address: 192.168.20.10 subnet_mask: 255.255.255.0 @@ -254,8 +246,7 @@ simulation: start_up_duration: 0 shut_down_duration: 0 - - ref: external_server - type: server + - type: server hostname: external_server ip_address: 192.168.20.11 subnet_mask: 255.255.255.0 @@ -263,46 +254,37 @@ simulation: start_up_duration: 0 shut_down_duration: 0 services: - - ref: domain_controller_dns_server - type: DNSServer + - type: DNSServer links: - - ref: client_1___switch_1 - endpoint_a_ref: client_1 + - endpoint_a_hostname: client_1 endpoint_a_port: 1 - endpoint_b_ref: switch_1 + endpoint_b_hostname: switch_1 endpoint_b_port: 1 - - ref: router_1___switch_1 - endpoint_a_ref: router_1 + - endpoint_a_hostname: router_1 endpoint_a_port: 1 - endpoint_b_ref: switch_1 + endpoint_b_hostname: switch_1 endpoint_b_port: 8 - - ref: router_1___firewall - endpoint_a_ref: firewall + - endpoint_a_hostname: firewall endpoint_a_port: 2 # internal firewall port - endpoint_b_ref: router_1 + endpoint_b_hostname: router_1 endpoint_b_port: 2 - - ref: firewall___switch_2 - endpoint_a_ref: firewall + - endpoint_a_hostname: firewall endpoint_a_port: 3 # dmz firewall port - endpoint_b_ref: switch_2 + endpoint_b_hostname: switch_2 endpoint_b_port: 8 - - ref: dmz_server___switch_2 - endpoint_a_ref: dmz_server + - endpoint_a_hostname: dmz_server endpoint_a_port: 1 - endpoint_b_ref: switch_2 + endpoint_b_hostname: switch_2 endpoint_b_port: 1 - - ref: firewall___switch_3 - endpoint_a_ref: firewall + - endpoint_a_hostname: firewall endpoint_a_port: 1 # external firewall port - endpoint_b_ref: switch_3 + endpoint_b_hostname: switch_3 endpoint_b_port: 8 - - ref: external_computer___switch_3 - endpoint_a_ref: external_computer + - endpoint_a_hostname: external_computer endpoint_a_port: 1 - endpoint_b_ref: switch_3 + endpoint_b_hostname: switch_3 endpoint_b_port: 1 - - ref: external_server___switch_3 - endpoint_a_ref: external_server + - endpoint_a_hostname: external_server endpoint_a_port: 1 - endpoint_b_ref: switch_3 + endpoint_b_hostname: switch_3 endpoint_b_port: 2 diff --git a/tests/assets/configs/eval_only_primaite_session.yaml b/tests/assets/configs/eval_only_primaite_session.yaml index 8723ae38..f05e3390 100644 --- a/tests/assets/configs/eval_only_primaite_session.yaml +++ b/tests/assets/configs/eval_only_primaite_session.yaml @@ -152,16 +152,16 @@ agents: label: LINKS options: link_references: - - router_1___switch_1 - - router_1___switch_2 - - switch_1___domain_controller - - switch_1___web_server - - switch_1___database_server - - switch_1___backup_server - - switch_1___security_suite - - switch_2___client_1 - - switch_2___client_2 - - switch_2___security_suite + - router_1:eth-1<->switch_1:eth-8 + - router_1:eth-2<->switch_2:eth-8 + - switch_1:eth-1<->domain_controller:eth-1 + - switch_1:eth-2<->web_server:eth-1 + - switch_1:eth-3<->database_server:eth-1 + - switch_1:eth-4<->backup_server:eth-1 + - switch_1:eth-7<->security_suite:eth-1 + - switch_2:eth-1<->client_1:eth-1 + - switch_2:eth-2<->client_2:eth-1 + - switch_2:eth-7<->security_suite:eth-2 - type: "NONE" label: ICS options: {} @@ -567,8 +567,7 @@ simulation: network: nodes: - - ref: router_1 - type: router + - type: router hostname: router_1 num_ports: 5 ports: @@ -595,70 +594,58 @@ simulation: action: PERMIT protocol: ICMP - - ref: switch_1 - type: switch + - type: switch hostname: switch_1 num_ports: 8 - - ref: switch_2 - type: switch + - type: switch hostname: switch_2 num_ports: 8 - - ref: domain_controller - type: server + - type: server hostname: domain_controller ip_address: 192.168.1.10 subnet_mask: 255.255.255.0 default_gateway: 192.168.1.1 services: - - ref: domain_controller_dns_server - type: DNSServer + - type: DNSServer options: domain_mapping: arcd.com: 192.168.1.12 # web server - - ref: web_server - type: server + - type: server hostname: web_server ip_address: 192.168.1.12 subnet_mask: 255.255.255.0 default_gateway: 192.168.1.1 dns_server: 192.168.1.10 services: - - ref: web_server_web_service - type: WebServer + - type: WebServer applications: - - ref: web_server_database_client - type: DatabaseClient + - type: DatabaseClient options: db_server_ip: 192.168.1.14 - - ref: database_server - type: server + - type: server hostname: database_server ip_address: 192.168.1.14 subnet_mask: 255.255.255.0 default_gateway: 192.168.1.1 dns_server: 192.168.1.10 services: - - ref: database_service - type: DatabaseService + - type: DatabaseService - - ref: backup_server - type: server + - type: server hostname: backup_server ip_address: 192.168.1.16 subnet_mask: 255.255.255.0 default_gateway: 192.168.1.1 dns_server: 192.168.1.10 services: - - ref: backup_service - type: FTPServer + - type: FTPServer - - ref: security_suite - type: server + - type: server hostname: security_suite ip_address: 192.168.1.110 subnet_mask: 255.255.255.0 @@ -669,87 +656,71 @@ simulation: ip_address: 192.168.10.110 subnet_mask: 255.255.255.0 - - ref: client_1 - type: computer + - type: computer hostname: client_1 ip_address: 192.168.10.21 subnet_mask: 255.255.255.0 default_gateway: 192.168.10.1 dns_server: 192.168.1.10 applications: - - ref: data_manipulation_bot - type: DataManipulationBot + - type: DataManipulationBot options: port_scan_p_of_success: 0.1 data_manipulation_p_of_success: 0.1 payload: "DELETE" server_ip: 192.168.1.14 services: - - ref: client_1_dns_client - type: DNSClient + - type: DNSClient - - ref: client_2 - type: computer + - type: computer hostname: client_2 ip_address: 192.168.10.22 subnet_mask: 255.255.255.0 default_gateway: 192.168.10.1 dns_server: 192.168.1.10 applications: - - ref: client_2_web_browser - type: WebBrowser + - type: WebBrowser services: - - ref: client_2_dns_client - type: DNSClient + - type: DNSClient links: - - ref: router_1___switch_1 - endpoint_a_ref: router_1 + - endpoint_a_hostname: router_1 endpoint_a_port: 1 - endpoint_b_ref: switch_1 + endpoint_b_hostname: switch_1 endpoint_b_port: 8 - - ref: router_1___switch_2 - endpoint_a_ref: router_1 + - endpoint_a_hostname: router_1 endpoint_a_port: 2 - endpoint_b_ref: switch_2 + endpoint_b_hostname: switch_2 endpoint_b_port: 8 - - ref: switch_1___domain_controller - endpoint_a_ref: switch_1 + - endpoint_a_hostname: switch_1 endpoint_a_port: 1 - endpoint_b_ref: domain_controller + endpoint_b_hostname: domain_controller endpoint_b_port: 1 - - ref: switch_1___web_server - endpoint_a_ref: switch_1 + - endpoint_a_hostname: switch_1 endpoint_a_port: 2 - endpoint_b_ref: web_server + endpoint_b_hostname: web_server endpoint_b_port: 1 - - ref: switch_1___database_server - endpoint_a_ref: switch_1 + - endpoint_a_hostname: switch_1 endpoint_a_port: 3 - endpoint_b_ref: database_server + endpoint_b_hostname: database_server endpoint_b_port: 1 - - ref: switch_1___backup_server - endpoint_a_ref: switch_1 + - endpoint_a_hostname: switch_1 endpoint_a_port: 4 - endpoint_b_ref: backup_server + endpoint_b_hostname: backup_server endpoint_b_port: 1 - - ref: switch_1___security_suite - endpoint_a_ref: switch_1 + - endpoint_a_hostname: switch_1 endpoint_a_port: 7 - endpoint_b_ref: security_suite + endpoint_b_hostname: security_suite endpoint_b_port: 1 - - ref: switch_2___client_1 - endpoint_a_ref: switch_2 + - endpoint_a_hostname: switch_2 endpoint_a_port: 1 - endpoint_b_ref: client_1 + endpoint_b_hostname: client_1 endpoint_b_port: 1 - - ref: switch_2___client_2 - endpoint_a_ref: switch_2 + - endpoint_a_hostname: switch_2 endpoint_a_port: 2 - endpoint_b_ref: client_2 + endpoint_b_hostname: client_2 endpoint_b_port: 1 - - ref: switch_2___security_suite - endpoint_a_ref: switch_2 + - endpoint_a_hostname: switch_2 endpoint_a_port: 7 - endpoint_b_ref: security_suite + endpoint_b_hostname: security_suite endpoint_b_port: 2 diff --git a/tests/assets/configs/firewall_actions_network.yaml b/tests/assets/configs/firewall_actions_network.yaml index 203ea3ea..1f4a45e0 100644 --- a/tests/assets/configs/firewall_actions_network.yaml +++ b/tests/assets/configs/firewall_actions_network.yaml @@ -101,7 +101,7 @@ agents: label: LINKS options: link_references: - - client_1___switch_1 + - client_1:eth-1<->switch_1:eth-1 - type: "NONE" label: ICS options: {} @@ -298,8 +298,7 @@ agents: simulation: network: nodes: - - ref: client_1 - type: computer + - type: computer hostname: client_1 ip_address: 192.168.0.10 subnet_mask: 255.255.255.0 @@ -308,15 +307,13 @@ simulation: start_up_duration: 0 shut_down_duration: 0 - - ref: switch_1 - type: switch + - type: switch hostname: switch_1 num_ports: 8 start_up_duration: 0 shut_down_duration: 0 - - ref: router_1 - type: router + - type: router hostname: router_1 num_ports: 5 start_up_duration: 0 @@ -350,8 +347,7 @@ simulation: next_hop_ip_address: 192.168.1.2 metric: 0 - - ref: dmz_server - type: server + - type: server hostname: dmz_server ip_address: 192.168.10.10 subnet_mask: 255.255.255.0 @@ -360,15 +356,13 @@ simulation: start_up_duration: 0 shut_down_duration: 0 - - ref: switch_2 - type: switch + - type: switch hostname: switch_2 num_ports: 8 start_up_duration: 0 shut_down_duration: 0 - - ref: firewall - type: firewall + - type: firewall hostname: firewall start_up_duration: 0 shut_down_duration: 0 @@ -431,15 +425,13 @@ simulation: next_hop_ip_address: 192.168.1.1 metric: 0 - - ref: switch_3 - type: switch + - type: switch hostname: switch_3 num_ports: 8 start_up_duration: 0 shut_down_duration: 0 - - ref: external_computer - type: computer + - type: computer hostname: external_computer ip_address: 192.168.20.10 subnet_mask: 255.255.255.0 @@ -448,8 +440,7 @@ simulation: start_up_duration: 0 shut_down_duration: 0 - - ref: external_server - type: server + - type: server hostname: external_server ip_address: 192.168.20.11 subnet_mask: 255.255.255.0 @@ -457,46 +448,37 @@ simulation: start_up_duration: 0 shut_down_duration: 0 services: - - ref: domain_controller_dns_server - type: DNSServer + - type: DNSServer links: - - ref: client_1___switch_1 - endpoint_a_ref: client_1 + - endpoint_a_hostname: client_1 endpoint_a_port: 1 - endpoint_b_ref: switch_1 + endpoint_b_hostname: switch_1 endpoint_b_port: 1 - - ref: router_1___switch_1 - endpoint_a_ref: router_1 + - endpoint_a_hostname: router_1 endpoint_a_port: 1 - endpoint_b_ref: switch_1 + endpoint_b_hostname: switch_1 endpoint_b_port: 8 - - ref: router_1___firewall - endpoint_a_ref: firewall + - endpoint_a_hostname: firewall endpoint_a_port: 2 # internal firewall port - endpoint_b_ref: router_1 + endpoint_b_hostname: router_1 endpoint_b_port: 2 - - ref: firewall___switch_2 - endpoint_a_ref: firewall + - endpoint_a_hostname: firewall endpoint_a_port: 3 # dmz firewall port - endpoint_b_ref: switch_2 + endpoint_b_hostname: switch_2 endpoint_b_port: 8 - - ref: dmz_server___switch_2 - endpoint_a_ref: dmz_server + - endpoint_a_hostname: dmz_server endpoint_a_port: 1 - endpoint_b_ref: switch_2 + endpoint_b_hostname: switch_2 endpoint_b_port: 1 - - ref: firewall___switch_3 - endpoint_a_ref: firewall + - endpoint_a_hostname: firewall endpoint_a_port: 1 # external firewall port - endpoint_b_ref: switch_3 + endpoint_b_hostname: switch_3 endpoint_b_port: 8 - - ref: external_computer___switch_3 - endpoint_a_ref: external_computer + - endpoint_a_hostname: external_computer endpoint_a_port: 1 - endpoint_b_ref: switch_3 + endpoint_b_hostname: switch_3 endpoint_b_port: 1 - - ref: external_server___switch_3 - endpoint_a_ref: external_server + - endpoint_a_hostname: external_server endpoint_a_port: 1 - endpoint_b_ref: switch_3 + endpoint_b_hostname: switch_3 endpoint_b_port: 2 diff --git a/tests/assets/configs/multi_agent_session.yaml b/tests/assets/configs/multi_agent_session.yaml index dd416523..6a37be80 100644 --- a/tests/assets/configs/multi_agent_session.yaml +++ b/tests/assets/configs/multi_agent_session.yaml @@ -147,16 +147,16 @@ agents: label: LINKS options: link_references: - - router_1___switch_1 - - router_1___switch_2 - - switch_1___domain_controller - - switch_1___web_server - - switch_1___database_server - - switch_1___backup_server - - switch_1___security_suite - - switch_2___client_1 - - switch_2___client_2 - - switch_2___security_suite + - router_1:eth-1<->switch_1:eth-8 + - router_1:eth-2<->switch_2:eth-8 + - switch_1:eth-1<->domain_controller:eth-1 + - switch_1:eth-2<->web_server:eth-1 + - switch_1:eth-3<->database_server:eth-1 + - switch_1:eth-4<->backup_server:eth-1 + - switch_1:eth-7<->security_suite:eth-1 + - switch_2:eth-1<->client_1:eth-1 + - switch_2:eth-2<->client_2:eth-1 + - switch_2:eth-7<->security_suite:eth-2 - type: "NONE" label: ICS options: {} @@ -613,16 +613,16 @@ agents: label: LINKS options: link_references: - - router_1___switch_1 - - router_1___switch_2 - - switch_1___domain_controller - - switch_1___web_server - - switch_1___database_server - - switch_1___backup_server - - switch_1___security_suite - - switch_2___client_1 - - switch_2___client_2 - - switch_2___security_suite + - router_1:eth-1<->switch_1:eth-8 + - router_1:eth-2<->switch_2:eth-8 + - switch_1:eth-1<->domain_controller:eth-1 + - switch_1:eth-2<->web_server:eth-1 + - switch_1:eth-3<->database_server:eth-1 + - switch_1:eth-4<->backup_server:eth-1 + - switch_1:eth-7<->security_suite:eth-1 + - switch_2:eth-1<->client_1:eth-1 + - switch_2:eth-2<->client_2:eth-1 + - switch_2:eth-7<->security_suite:eth-2 - type: "NONE" label: ICS options: {} @@ -1027,8 +1027,7 @@ simulation: network: nodes: - - ref: router_1 - type: router + - type: router hostname: router_1 num_ports: 5 ports: @@ -1055,69 +1054,57 @@ simulation: action: PERMIT protocol: ICMP - - ref: switch_1 - type: switch + - type: switch hostname: switch_1 num_ports: 8 - - ref: switch_2 - type: switch + - type: switch hostname: switch_2 num_ports: 8 - - ref: domain_controller - type: server + - type: server hostname: domain_controller ip_address: 192.168.1.10 subnet_mask: 255.255.255.0 default_gateway: 192.168.1.1 services: - - ref: domain_controller_dns_server - type: DNSServer + - type: DNSServer options: domain_mapping: arcd.com: 192.168.1.12 # web server - - ref: web_server - type: server + - type: server hostname: web_server ip_address: 192.168.1.12 subnet_mask: 255.255.255.0 default_gateway: 192.168.1.1 dns_server: 192.168.1.10 services: - - ref: web_server_web_service - type: WebServer + - type: WebServer applications: - - ref: web_server_database_client - type: DatabaseClient + - type: DatabaseClient options: db_server_ip: 192.168.1.14 - - ref: database_server - type: server + - type: server hostname: database_server ip_address: 192.168.1.14 subnet_mask: 255.255.255.0 default_gateway: 192.168.1.1 dns_server: 192.168.1.10 services: - - ref: database_service - type: DatabaseService + - type: DatabaseService - - ref: backup_server - type: server + - type: server hostname: backup_server ip_address: 192.168.1.16 subnet_mask: 255.255.255.0 default_gateway: 192.168.1.1 dns_server: 192.168.1.10 services: - - ref: backup_service - type: FTPServer + - type: FTPServer - - ref: security_suite - type: server + - type: server hostname: security_suite ip_address: 192.168.1.110 subnet_mask: 255.255.255.0 @@ -1128,87 +1115,71 @@ simulation: ip_address: 192.168.10.110 subnet_mask: 255.255.255.0 - - ref: client_1 - type: computer + - type: computer hostname: client_1 ip_address: 192.168.10.21 subnet_mask: 255.255.255.0 default_gateway: 192.168.10.1 dns_server: 192.168.1.10 applications: - - ref: data_manipulation_bot - type: DataManipulationBot + - type: DataManipulationBot options: port_scan_p_of_success: 0.1 data_manipulation_p_of_success: 0.1 payload: "DELETE" server_ip: 192.168.1.14 services: - - ref: client_1_dns_client - type: DNSClient + - type: DNSClient - - ref: client_2 - type: computer + - type: computer hostname: client_2 ip_address: 192.168.10.22 subnet_mask: 255.255.255.0 default_gateway: 192.168.10.1 dns_server: 192.168.1.10 applications: - - ref: client_2_web_browser - type: WebBrowser + - type: WebBrowser services: - - ref: client_2_dns_client - type: DNSClient + - type: DNSClient links: - - ref: router_1___switch_1 - endpoint_a_ref: router_1 + - endpoint_a_hostname: router_1 endpoint_a_port: 1 - endpoint_b_ref: switch_1 + endpoint_b_hostname: switch_1 endpoint_b_port: 8 - - ref: router_1___switch_2 - endpoint_a_ref: router_1 + - endpoint_a_hostname: router_1 endpoint_a_port: 2 - endpoint_b_ref: switch_2 + endpoint_b_hostname: switch_2 endpoint_b_port: 8 - - ref: switch_1___domain_controller - endpoint_a_ref: switch_1 + - endpoint_a_hostname: switch_1 endpoint_a_port: 1 - endpoint_b_ref: domain_controller + endpoint_b_hostname: domain_controller endpoint_b_port: 1 - - ref: switch_1___web_server - endpoint_a_ref: switch_1 + - endpoint_a_hostname: switch_1 endpoint_a_port: 2 - endpoint_b_ref: web_server + endpoint_b_hostname: web_server endpoint_b_port: 1 - - ref: switch_1___database_server - endpoint_a_ref: switch_1 + - endpoint_a_hostname: switch_1 endpoint_a_port: 3 - endpoint_b_ref: database_server + endpoint_b_hostname: database_server endpoint_b_port: 1 - - ref: switch_1___backup_server - endpoint_a_ref: switch_1 + - endpoint_a_hostname: switch_1 endpoint_a_port: 4 - endpoint_b_ref: backup_server + endpoint_b_hostname: backup_server endpoint_b_port: 1 - - ref: switch_1___security_suite - endpoint_a_ref: switch_1 + - endpoint_a_hostname: switch_1 endpoint_a_port: 7 - endpoint_b_ref: security_suite + endpoint_b_hostname: security_suite endpoint_b_port: 1 - - ref: switch_2___client_1 - endpoint_a_ref: switch_2 + - endpoint_a_hostname: switch_2 endpoint_a_port: 1 - endpoint_b_ref: client_1 + endpoint_b_hostname: client_1 endpoint_b_port: 1 - - ref: switch_2___client_2 - endpoint_a_ref: switch_2 + - endpoint_a_hostname: switch_2 endpoint_a_port: 2 - endpoint_b_ref: client_2 + endpoint_b_hostname: client_2 endpoint_b_port: 1 - - ref: switch_2___security_suite - endpoint_a_ref: switch_2 + - endpoint_a_hostname: switch_2 endpoint_a_port: 7 - endpoint_b_ref: security_suite + endpoint_b_hostname: security_suite endpoint_b_port: 2 diff --git a/tests/assets/configs/shared_rewards.yaml b/tests/assets/configs/shared_rewards.yaml index 4b925844..bfa03ace 100644 --- a/tests/assets/configs/shared_rewards.yaml +++ b/tests/assets/configs/shared_rewards.yaml @@ -226,16 +226,16 @@ agents: label: LINKS options: link_references: - - router_1___switch_1 - - router_1___switch_2 - - switch_1___domain_controller - - switch_1___web_server - - switch_1___database_server - - switch_1___backup_server - - switch_1___security_suite - - switch_2___client_1 - - switch_2___client_2 - - switch_2___security_suite + - router_1:eth-1<->switch_1:eth-8 + - router_1:eth-2<->switch_2:eth-8 + - switch_1:eth-1<->domain_controller:eth-1 + - switch_1:eth-2<->web_server:eth-1 + - switch_1:eth-3<->database_server:eth-1 + - switch_1:eth-4<->backup_server:eth-1 + - switch_1:eth-7<->security_suite:eth-1 + - switch_2:eth-1<->client_1:eth-1 + - switch_2:eth-2<->client_2:eth-1 + - switch_2:eth-7<->security_suite:eth-2 - type: "NONE" label: ICS options: {} @@ -750,8 +750,7 @@ simulation: - DELETE nodes: - - ref: router_1 - hostname: router_1 + - hostname: router_1 type: router num_ports: 5 ports: @@ -786,74 +785,61 @@ simulation: action: PERMIT protocol: ICMP - - ref: switch_1 - hostname: switch_1 + - hostname: switch_1 type: switch num_ports: 8 - - ref: switch_2 - hostname: switch_2 + - hostname: switch_2 type: switch num_ports: 8 - - ref: domain_controller - hostname: domain_controller + - hostname: domain_controller type: server ip_address: 192.168.1.10 subnet_mask: 255.255.255.0 default_gateway: 192.168.1.1 services: - - ref: domain_controller_dns_server - type: DNSServer + - type: DNSServer options: domain_mapping: arcd.com: 192.168.1.12 # web server - - ref: web_server - hostname: web_server + - hostname: web_server type: server ip_address: 192.168.1.12 subnet_mask: 255.255.255.0 default_gateway: 192.168.1.1 dns_server: 192.168.1.10 services: - - ref: web_server_web_service - type: WebServer + - type: WebServer applications: - - ref: web_server_database_client - type: DatabaseClient + - type: DatabaseClient options: db_server_ip: 192.168.1.14 - - ref: database_server - hostname: database_server + - hostname: database_server type: server ip_address: 192.168.1.14 subnet_mask: 255.255.255.0 default_gateway: 192.168.1.1 dns_server: 192.168.1.10 services: - - ref: database_service - type: DatabaseService + - type: DatabaseService options: backup_server_ip: 192.168.1.16 - - ref: database_ftp_client - type: FTPClient + - type: FTPClient - - ref: backup_server - hostname: backup_server + - hostname: backup_server type: server ip_address: 192.168.1.16 subnet_mask: 255.255.255.0 default_gateway: 192.168.1.1 dns_server: 192.168.1.10 services: - - ref: backup_service - type: FTPServer + - type: FTPServer - - ref: security_suite - hostname: security_suite + - hostname: security_suite type: server ip_address: 192.168.1.110 subnet_mask: 255.255.255.0 @@ -864,110 +850,90 @@ simulation: ip_address: 192.168.10.110 subnet_mask: 255.255.255.0 - - ref: client_1 - hostname: client_1 + - hostname: client_1 type: computer ip_address: 192.168.10.21 subnet_mask: 255.255.255.0 default_gateway: 192.168.10.1 dns_server: 192.168.1.10 applications: - - ref: data_manipulation_bot - type: DataManipulationBot + - type: DataManipulationBot options: port_scan_p_of_success: 0.8 data_manipulation_p_of_success: 0.8 payload: "DELETE" server_ip: 192.168.1.14 - - ref: client_1_web_browser - type: WebBrowser + - type: WebBrowser options: target_url: http://arcd.com/users/ - - ref: client_1_database_client - type: DatabaseClient + - type: DatabaseClient options: db_server_ip: 192.168.1.14 services: - - ref: client_1_dns_client - type: DNSClient + - type: DNSClient - - ref: client_2 - hostname: client_2 + - hostname: client_2 type: computer ip_address: 192.168.10.22 subnet_mask: 255.255.255.0 default_gateway: 192.168.10.1 dns_server: 192.168.1.10 applications: - - ref: client_2_web_browser - type: WebBrowser + - type: WebBrowser options: target_url: http://arcd.com/users/ - - ref: data_manipulation_bot - type: DataManipulationBot + - type: DataManipulationBot options: port_scan_p_of_success: 0.8 data_manipulation_p_of_success: 0.8 payload: "DELETE" server_ip: 192.168.1.14 - - ref: client_2_database_client - type: DatabaseClient + - type: DatabaseClient options: db_server_ip: 192.168.1.14 services: - - ref: client_2_dns_client - type: DNSClient + - type: DNSClient links: - - ref: router_1___switch_1 - endpoint_a_ref: router_1 + - endpoint_a_hostname: router_1 endpoint_a_port: 1 - endpoint_b_ref: switch_1 + endpoint_b_hostname: switch_1 endpoint_b_port: 8 - - ref: router_1___switch_2 - endpoint_a_ref: router_1 + - endpoint_a_hostname: router_1 endpoint_a_port: 2 - endpoint_b_ref: switch_2 + endpoint_b_hostname: switch_2 endpoint_b_port: 8 - - ref: switch_1___domain_controller - endpoint_a_ref: switch_1 + - endpoint_a_hostname: switch_1 endpoint_a_port: 1 - endpoint_b_ref: domain_controller + endpoint_b_hostname: domain_controller endpoint_b_port: 1 - - ref: switch_1___web_server - endpoint_a_ref: switch_1 + - endpoint_a_hostname: switch_1 endpoint_a_port: 2 - endpoint_b_ref: web_server + endpoint_b_hostname: web_server endpoint_b_port: 1 - - ref: switch_1___database_server - endpoint_a_ref: switch_1 + - endpoint_a_hostname: switch_1 endpoint_a_port: 3 - endpoint_b_ref: database_server + endpoint_b_hostname: database_server endpoint_b_port: 1 - - ref: switch_1___backup_server - endpoint_a_ref: switch_1 + - endpoint_a_hostname: switch_1 endpoint_a_port: 4 - endpoint_b_ref: backup_server + endpoint_b_hostname: backup_server endpoint_b_port: 1 - - ref: switch_1___security_suite - endpoint_a_ref: switch_1 + - endpoint_a_hostname: switch_1 endpoint_a_port: 7 - endpoint_b_ref: security_suite + endpoint_b_hostname: security_suite endpoint_b_port: 1 - - ref: switch_2___client_1 - endpoint_a_ref: switch_2 + - endpoint_a_hostname: switch_2 endpoint_a_port: 1 - endpoint_b_ref: client_1 + endpoint_b_hostname: client_1 endpoint_b_port: 1 - - ref: switch_2___client_2 - endpoint_a_ref: switch_2 + - endpoint_a_hostname: switch_2 endpoint_a_port: 2 - endpoint_b_ref: client_2 + endpoint_b_hostname: client_2 endpoint_b_port: 1 - - ref: switch_2___security_suite - endpoint_a_ref: switch_2 + - endpoint_a_hostname: switch_2 endpoint_a_port: 7 - endpoint_b_ref: security_suite + endpoint_b_hostname: security_suite endpoint_b_port: 2 diff --git a/tests/assets/configs/test_application_install.yaml b/tests/assets/configs/test_application_install.yaml index ccd2228c..3323937e 100644 --- a/tests/assets/configs/test_application_install.yaml +++ b/tests/assets/configs/test_application_install.yaml @@ -226,16 +226,16 @@ agents: label: LINKS options: link_references: - - router_1___switch_1 - - router_1___switch_2 - - switch_1___domain_controller - - switch_1___web_server - - switch_1___database_server - - switch_1___backup_server - - switch_1___security_suite - - switch_2___client_1 - - switch_2___client_2 - - switch_2___security_suite + - router_1:eth-1<->switch_1:eth-8 + - router_1:eth-2<->switch_2:eth-8 + - switch_1:eth-1<->domain_controller:eth-1 + - switch_1:eth-2<->web_server:eth-1 + - switch_1:eth-3<->database_server:eth-1 + - switch_1:eth-4<->backup_server:eth-1 + - switch_1:eth-7<->security_suite:eth-1 + - switch_2:eth-1<->client_1:eth-1 + - switch_2:eth-2<->client_2:eth-1 + - switch_2:eth-7<->security_suite:eth-2 - type: "NONE" label: ICS options: {} @@ -782,8 +782,7 @@ simulation: - DELETE nodes: - - ref: router_1 - hostname: router_1 + - hostname: router_1 type: router num_ports: 5 ports: @@ -818,74 +817,61 @@ simulation: action: PERMIT protocol: ICMP - - ref: switch_1 - hostname: switch_1 + - hostname: switch_1 type: switch num_ports: 8 - - ref: switch_2 - hostname: switch_2 + - hostname: switch_2 type: switch num_ports: 8 - - ref: domain_controller - hostname: domain_controller + - hostname: domain_controller type: server ip_address: 192.168.1.10 subnet_mask: 255.255.255.0 default_gateway: 192.168.1.1 services: - - ref: domain_controller_dns_server - type: DNSServer + - type: DNSServer options: domain_mapping: arcd.com: 192.168.1.12 # web server - - ref: web_server - hostname: web_server + - hostname: web_server type: server ip_address: 192.168.1.12 subnet_mask: 255.255.255.0 default_gateway: 192.168.1.1 dns_server: 192.168.1.10 services: - - ref: web_server_web_service - type: WebServer + - type: WebServer applications: - - ref: web_server_database_client - type: DatabaseClient + - type: DatabaseClient options: db_server_ip: 192.168.1.14 - - ref: database_server - hostname: database_server + - hostname: database_server type: server ip_address: 192.168.1.14 subnet_mask: 255.255.255.0 default_gateway: 192.168.1.1 dns_server: 192.168.1.10 services: - - ref: database_service - type: DatabaseService + - type: DatabaseService options: backup_server_ip: 192.168.1.16 - - ref: database_ftp_client - type: FTPClient + - type: FTPClient - - ref: backup_server - hostname: backup_server + - hostname: backup_server type: server ip_address: 192.168.1.16 subnet_mask: 255.255.255.0 default_gateway: 192.168.1.1 dns_server: 192.168.1.10 services: - - ref: backup_service - type: FTPServer + - type: FTPServer - - ref: security_suite - hostname: security_suite + - hostname: security_suite type: server ip_address: 192.168.1.110 subnet_mask: 255.255.255.0 @@ -896,110 +882,90 @@ simulation: ip_address: 192.168.10.110 subnet_mask: 255.255.255.0 - - ref: client_1 - hostname: client_1 + - hostname: client_1 type: computer ip_address: 192.168.10.21 subnet_mask: 255.255.255.0 default_gateway: 192.168.10.1 dns_server: 192.168.1.10 applications: - - ref: data_manipulation_bot - type: DataManipulationBot + - type: DataManipulationBot options: port_scan_p_of_success: 0.8 data_manipulation_p_of_success: 0.8 payload: "DELETE" server_ip: 192.168.1.14 - - ref: client_1_web_browser - type: WebBrowser + - type: WebBrowser options: target_url: http://arcd.com/users/ - - ref: client_1_database_client - type: DatabaseClient + - type: DatabaseClient options: db_server_ip: 192.168.1.14 services: - - ref: client_1_dns_client - type: DNSClient + - type: DNSClient - - ref: client_2 - hostname: client_2 + - hostname: client_2 type: computer ip_address: 192.168.10.22 subnet_mask: 255.255.255.0 default_gateway: 192.168.10.1 dns_server: 192.168.1.10 applications: - - ref: client_2_web_browser - type: WebBrowser + - type: WebBrowser options: target_url: http://arcd.com/users/ - - ref: data_manipulation_bot - type: DataManipulationBot + - type: DataManipulationBot options: port_scan_p_of_success: 0.8 data_manipulation_p_of_success: 0.8 payload: "DELETE" server_ip: 192.168.1.14 - - ref: client_2_database_client - type: DatabaseClient + - type: DatabaseClient options: db_server_ip: 192.168.1.14 services: - - ref: client_2_dns_client - type: DNSClient + - type: DNSClient links: - - ref: router_1___switch_1 - endpoint_a_ref: router_1 + - endpoint_a_hostname: router_1 endpoint_a_port: 1 - endpoint_b_ref: switch_1 + endpoint_b_hostname: switch_1 endpoint_b_port: 8 - - ref: router_1___switch_2 - endpoint_a_ref: router_1 + - endpoint_a_hostname: router_1 endpoint_a_port: 2 - endpoint_b_ref: switch_2 + endpoint_b_hostname: switch_2 endpoint_b_port: 8 - - ref: switch_1___domain_controller - endpoint_a_ref: switch_1 + - endpoint_a_hostname: switch_1 endpoint_a_port: 1 - endpoint_b_ref: domain_controller + endpoint_b_hostname: domain_controller endpoint_b_port: 1 - - ref: switch_1___web_server - endpoint_a_ref: switch_1 + - endpoint_a_hostname: switch_1 endpoint_a_port: 2 - endpoint_b_ref: web_server + endpoint_b_hostname: web_server endpoint_b_port: 1 - - ref: switch_1___database_server - endpoint_a_ref: switch_1 + - endpoint_a_hostname: switch_1 endpoint_a_port: 3 - endpoint_b_ref: database_server + endpoint_b_hostname: database_server endpoint_b_port: 1 - - ref: switch_1___backup_server - endpoint_a_ref: switch_1 + - endpoint_a_hostname: switch_1 endpoint_a_port: 4 - endpoint_b_ref: backup_server + endpoint_b_hostname: backup_server endpoint_b_port: 1 - - ref: switch_1___security_suite - endpoint_a_ref: switch_1 + - endpoint_a_hostname: switch_1 endpoint_a_port: 7 - endpoint_b_ref: security_suite + endpoint_b_hostname: security_suite endpoint_b_port: 1 - - ref: switch_2___client_1 - endpoint_a_ref: switch_2 + - endpoint_a_hostname: switch_2 endpoint_a_port: 1 - endpoint_b_ref: client_1 + endpoint_b_hostname: client_1 endpoint_b_port: 1 - - ref: switch_2___client_2 - endpoint_a_ref: switch_2 + - endpoint_a_hostname: switch_2 endpoint_a_port: 2 - endpoint_b_ref: client_2 + endpoint_b_hostname: client_2 endpoint_b_port: 1 - - ref: switch_2___security_suite - endpoint_a_ref: switch_2 + - endpoint_a_hostname: switch_2 endpoint_a_port: 7 - endpoint_b_ref: security_suite + endpoint_b_hostname: security_suite endpoint_b_port: 2 diff --git a/tests/assets/configs/test_primaite_session.yaml b/tests/assets/configs/test_primaite_session.yaml index 8bad2f0b..9284f1d1 100644 --- a/tests/assets/configs/test_primaite_session.yaml +++ b/tests/assets/configs/test_primaite_session.yaml @@ -160,16 +160,16 @@ agents: label: LINKS options: link_references: - - router_1___switch_1 - - router_1___switch_2 - - switch_1___domain_controller - - switch_1___web_server - - switch_1___database_server - - switch_1___backup_server - - switch_1___security_suite - - switch_2___client_1 - - switch_2___client_2 - - switch_2___security_suite + - router_1:eth-1<->switch_1:eth-8 + - router_1:eth-2<->switch_2:eth-8 + - switch_1:eth-1<->domain_controller:eth-1 + - switch_1:eth-2<->web_server:eth-1 + - switch_1:eth-3<->database_server:eth-1 + - switch_1:eth-4<->backup_server:eth-1 + - switch_1:eth-7<->security_suite:eth-1 + - switch_2:eth-1<->client_1:eth-1 + - switch_2:eth-2<->client_2:eth-1 + - switch_2:eth-7<->security_suite:eth-2 - type: "NONE" label: ICS options: {} @@ -574,8 +574,7 @@ simulation: network: nodes: - - ref: router_1 - type: router + - type: router hostname: router_1 num_ports: 5 ports: @@ -602,70 +601,58 @@ simulation: action: PERMIT protocol: ICMP - - ref: switch_1 - type: switch + - type: switch hostname: switch_1 num_ports: 8 - - ref: switch_2 - type: switch + - type: switch hostname: switch_2 num_ports: 8 - - ref: domain_controller - type: server + - type: server hostname: domain_controller ip_address: 192.168.1.10 subnet_mask: 255.255.255.0 default_gateway: 192.168.1.1 services: - - ref: domain_controller_dns_server - type: DNSServer + - type: DNSServer options: domain_mapping: arcd.com: 192.168.1.12 # web server - - ref: web_server - type: server + - type: server hostname: web_server ip_address: 192.168.1.12 subnet_mask: 255.255.255.0 default_gateway: 192.168.1.1 dns_server: 192.168.1.10 services: - - ref: web_server_web_service - type: WebServer + - type: WebServer applications: - - ref: web_server_database_client - type: DatabaseClient + - type: DatabaseClient options: db_server_ip: 192.168.1.14 - - ref: database_server - type: server + - type: server hostname: database_server ip_address: 192.168.1.14 subnet_mask: 255.255.255.0 default_gateway: 192.168.1.1 dns_server: 192.168.1.10 services: - - ref: database_service - type: DatabaseService + - type: DatabaseService - - ref: backup_server - type: server + - type: server hostname: backup_server ip_address: 192.168.1.16 subnet_mask: 255.255.255.0 default_gateway: 192.168.1.1 dns_server: 192.168.1.10 services: - - ref: backup_service - type: FTPServer + - type: FTPServer - - ref: security_suite - type: server + - type: server hostname: security_suite ip_address: 192.168.1.110 subnet_mask: 255.255.255.0 @@ -676,47 +663,39 @@ simulation: ip_address: 192.168.10.110 subnet_mask: 255.255.255.0 - - ref: client_1 - type: computer + - type: computer hostname: client_1 ip_address: 192.168.10.21 subnet_mask: 255.255.255.0 default_gateway: 192.168.10.1 dns_server: 192.168.1.10 applications: - - ref: data_manipulation_bot - type: DataManipulationBot + - type: DataManipulationBot options: port_scan_p_of_success: 0.1 data_manipulation_p_of_success: 0.1 payload: "DELETE" server_ip: 192.168.1.14 services: - - ref: client_1_dns_client - type: DNSClient + - type: DNSClient - - ref: client_2 - type: computer + - type: computer hostname: client_2 ip_address: 192.168.10.22 subnet_mask: 255.255.255.0 default_gateway: 192.168.10.1 dns_server: 192.168.1.10 applications: - - ref: client_2_web_browser - type: WebBrowser + - type: WebBrowser services: - - ref: client_2_dns_client - type: DNSClient + - type: DNSClient - - ref: HP_LaserJet_Pro_4102fdn_printer - type: printer + - type: printer hostname: HP_LaserJet_Pro_4102fdn_printer ip_address: 192.168.10.99 subnet_mask: 255.255.255.0 - - ref: router_2 - type: wireless_router + - type: wireless_router hostname: router_2 router_interface: ip_address: 192.169.1.1 @@ -743,53 +722,43 @@ simulation: protocol: ICMP links: - - ref: router_1___switch_1 - endpoint_a_ref: router_1 + - endpoint_a_hostname: router_1 endpoint_a_port: 1 - endpoint_b_ref: switch_1 + endpoint_b_hostname: switch_1 endpoint_b_port: 8 - - ref: router_1___switch_2 - endpoint_a_ref: router_1 + - endpoint_a_hostname: router_1 endpoint_a_port: 2 - endpoint_b_ref: switch_2 + endpoint_b_hostname: switch_2 endpoint_b_port: 8 - - ref: switch_1___domain_controller - endpoint_a_ref: switch_1 + - endpoint_a_hostname: switch_1 endpoint_a_port: 1 - endpoint_b_ref: domain_controller + endpoint_b_hostname: domain_controller endpoint_b_port: 1 - - ref: switch_1___web_server - endpoint_a_ref: switch_1 + - endpoint_a_hostname: switch_1 endpoint_a_port: 2 - endpoint_b_ref: web_server + endpoint_b_hostname: web_server endpoint_b_port: 1 - - ref: switch_1___database_server - endpoint_a_ref: switch_1 + - endpoint_a_hostname: switch_1 endpoint_a_port: 3 - endpoint_b_ref: database_server + endpoint_b_hostname: database_server endpoint_b_port: 1 - - ref: switch_1___backup_server - endpoint_a_ref: switch_1 + - endpoint_a_hostname: switch_1 endpoint_a_port: 4 - endpoint_b_ref: backup_server + endpoint_b_hostname: backup_server endpoint_b_port: 1 - - ref: switch_1___security_suite - endpoint_a_ref: switch_1 + - endpoint_a_hostname: switch_1 endpoint_a_port: 7 - endpoint_b_ref: security_suite + endpoint_b_hostname: security_suite endpoint_b_port: 1 - - ref: switch_2___client_1 - endpoint_a_ref: switch_2 + - endpoint_a_hostname: switch_2 endpoint_a_port: 1 - endpoint_b_ref: client_1 + endpoint_b_hostname: client_1 endpoint_b_port: 1 - - ref: switch_2___client_2 - endpoint_a_ref: switch_2 + - endpoint_a_hostname: switch_2 endpoint_a_port: 2 - endpoint_b_ref: client_2 + endpoint_b_hostname: client_2 endpoint_b_port: 1 - - ref: switch_2___security_suite - endpoint_a_ref: switch_2 + - endpoint_a_hostname: switch_2 endpoint_a_port: 7 - endpoint_b_ref: security_suite + endpoint_b_hostname: security_suite endpoint_b_port: 2 diff --git a/tests/assets/configs/train_only_primaite_session.yaml b/tests/assets/configs/train_only_primaite_session.yaml index fcfbaf15..7d1ac09f 100644 --- a/tests/assets/configs/train_only_primaite_session.yaml +++ b/tests/assets/configs/train_only_primaite_session.yaml @@ -160,16 +160,16 @@ agents: label: LINKS options: link_references: - - router_1___switch_1 - - router_1___switch_2 - - switch_1___domain_controller - - switch_1___web_server - - switch_1___database_server - - switch_1___backup_server - - switch_1___security_suite - - switch_2___client_1 - - switch_2___client_2 - - switch_2___security_suite + - router_1:eth-1<->switch_1:eth-8 + - router_1:eth-2<->switch_2:eth-8 + - switch_1:eth-1<->domain_controller:eth-1 + - switch_1:eth-2<->web_server:eth-1 + - switch_1:eth-3<->database_server:eth-1 + - switch_1:eth-4<->backup_server:eth-1 + - switch_1:eth-7<->security_suite:eth-1 + - switch_2:eth-1<->client_1:eth-1 + - switch_2:eth-2<->client_2:eth-1 + - switch_2:eth-7<->security_suite:eth-2 - type: "NONE" label: ICS options: {} @@ -574,8 +574,7 @@ simulation: network: nodes: - - ref: router_1 - type: router + - type: router hostname: router_1 num_ports: 5 ports: @@ -602,70 +601,58 @@ simulation: action: PERMIT protocol: ICMP - - ref: switch_1 - type: switch + - type: switch hostname: switch_1 num_ports: 8 - - ref: switch_2 - type: switch + - type: switch hostname: switch_2 num_ports: 8 - - ref: domain_controller - type: server + - type: server hostname: domain_controller ip_address: 192.168.1.10 subnet_mask: 255.255.255.0 default_gateway: 192.168.1.1 services: - - ref: domain_controller_dns_server - type: DNSServer + - type: DNSServer options: domain_mapping: arcd.com: 192.168.1.12 # web server - - ref: web_server - type: server + - type: server hostname: web_server ip_address: 192.168.1.12 subnet_mask: 255.255.255.0 default_gateway: 192.168.1.1 dns_server: 192.168.1.10 services: - - ref: web_server_web_service - type: WebServer + - type: WebServer applications: - - ref: web_server_database_client - type: DatabaseClient + - type: DatabaseClient options: db_server_ip: 192.168.1.14 - - ref: database_server - type: server + - type: server hostname: database_server ip_address: 192.168.1.14 subnet_mask: 255.255.255.0 default_gateway: 192.168.1.1 dns_server: 192.168.1.10 services: - - ref: database_service - type: DatabaseService + - type: DatabaseService - - ref: backup_server - type: server + - type: server hostname: backup_server ip_address: 192.168.1.16 subnet_mask: 255.255.255.0 default_gateway: 192.168.1.1 dns_server: 192.168.1.10 services: - - ref: backup_service - type: FTPServer + - type: FTPServer - - ref: security_suite - type: server + - type: server hostname: security_suite ip_address: 192.168.1.110 subnet_mask: 255.255.255.0 @@ -676,87 +663,71 @@ simulation: ip_address: 192.168.10.110 subnet_mask: 255.255.255.0 - - ref: client_1 - type: computer + - type: computer hostname: client_1 ip_address: 192.168.10.21 subnet_mask: 255.255.255.0 default_gateway: 192.168.10.1 dns_server: 192.168.1.10 applications: - - ref: data_manipulation_bot - type: DataManipulationBot + - type: DataManipulationBot options: port_scan_p_of_success: 0.1 data_manipulation_p_of_success: 0.1 payload: "DELETE" server_ip: 192.168.1.14 services: - - ref: client_1_dns_client - type: DNSClient + - type: DNSClient - - ref: client_2 - type: computer + - type: computer hostname: client_2 ip_address: 192.168.10.22 subnet_mask: 255.255.255.0 default_gateway: 192.168.10.1 dns_server: 192.168.1.10 applications: - - ref: client_2_web_browser - type: WebBrowser + - type: WebBrowser services: - - ref: client_2_dns_client - type: DNSClient + - type: DNSClient links: - - ref: router_1___switch_1 - endpoint_a_ref: router_1 + - endpoint_a_hostname: router_1 endpoint_a_port: 1 - endpoint_b_ref: switch_1 + endpoint_b_hostname: switch_1 endpoint_b_port: 8 - - ref: router_1___switch_2 - endpoint_a_ref: router_1 + - endpoint_a_hostname: router_1 endpoint_a_port: 2 - endpoint_b_ref: switch_2 + endpoint_b_hostname: switch_2 endpoint_b_port: 8 - - ref: switch_1___domain_controller - endpoint_a_ref: switch_1 + - endpoint_a_hostname: switch_1 endpoint_a_port: 1 - endpoint_b_ref: domain_controller + endpoint_b_hostname: domain_controller endpoint_b_port: 1 - - ref: switch_1___web_server - endpoint_a_ref: switch_1 + - endpoint_a_hostname: switch_1 endpoint_a_port: 2 - endpoint_b_ref: web_server + endpoint_b_hostname: web_server endpoint_b_port: 1 - - ref: switch_1___database_server - endpoint_a_ref: switch_1 + - endpoint_a_hostname: switch_1 endpoint_a_port: 3 - endpoint_b_ref: database_server + endpoint_b_hostname: database_server endpoint_b_port: 1 - - ref: switch_1___backup_server - endpoint_a_ref: switch_1 + - endpoint_a_hostname: switch_1 endpoint_a_port: 4 - endpoint_b_ref: backup_server + endpoint_b_hostname: backup_server endpoint_b_port: 1 - - ref: switch_1___security_suite - endpoint_a_ref: switch_1 + - endpoint_a_hostname: switch_1 endpoint_a_port: 7 - endpoint_b_ref: security_suite + endpoint_b_hostname: security_suite endpoint_b_port: 1 - - ref: switch_2___client_1 - endpoint_a_ref: switch_2 + - endpoint_a_hostname: switch_2 endpoint_a_port: 1 - endpoint_b_ref: client_1 + endpoint_b_hostname: client_1 endpoint_b_port: 1 - - ref: switch_2___client_2 - endpoint_a_ref: switch_2 + - endpoint_a_hostname: switch_2 endpoint_a_port: 2 - endpoint_b_ref: client_2 + endpoint_b_hostname: client_2 endpoint_b_port: 1 - - ref: switch_2___security_suite - endpoint_a_ref: switch_2 + - endpoint_a_hostname: switch_2 endpoint_a_port: 7 - endpoint_b_ref: security_suite + endpoint_b_hostname: security_suite endpoint_b_port: 2 diff --git a/tests/integration_tests/game_layer/observations/test_link_observations.py b/tests/integration_tests/game_layer/observations/test_link_observations.py index 3eee72e8..dce7b23d 100644 --- a/tests/integration_tests/game_layer/observations/test_link_observations.py +++ b/tests/integration_tests/game_layer/observations/test_link_observations.py @@ -69,8 +69,8 @@ def test_link_observation(): assert link_1 is not None assert link_2 is not None - link_1_observation = LinkObservation(where=["network", "links", link_1.uuid]) - link_2_observation = LinkObservation(where=["network", "links", link_2.uuid]) + link_1_observation = LinkObservation(where=["network", "links", "switch:eth-1<->computer_1:eth-1"]) + link_2_observation = LinkObservation(where=["network", "links", "switch:eth-2<->computer_2:eth-1"]) state = sim.describe_state() link_1_obs = link_1_observation.observe(state)