From 56a17c3feaae798fce35fd45581160891ddef4d1 Mon Sep 17 00:00:00 2001 From: Marek Wolan Date: Tue, 8 Oct 2024 13:40:40 +0100 Subject: [PATCH] Update typos and comments according to PR comments --- CHANGELOG.md | 6 +++--- docs/source/node_sets.rst | 2 +- src/primaite/game/game.py | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b0ee24be..e54f32e5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,14 +19,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Added reward calculation details to AgentHistoryItem. - Added a new Privilege-Escalation-and Data-Loss-Example.ipynb notebook with a realistic cyber scenario focusing on internal privilege escalation and data loss through the manipulation of SSH access and Access Control Lists (ACLs). -- Added a new extendible `NetworkNodeAdder` class for convenient addition of sets of nodes based on a simplified config. +- Added a new extensible `NetworkNodeAdder` class for convenient addition of sets of nodes based on a simplified config. ### Changed - File and folder observations can now be configured to always show the true health status, or require scanning like before. - It's now possible to disable stickiness on reward components, meaning their value returns to 0 during timesteps where agent don't issue the corresponding action. Affects `GreenAdminDatabaseUnreachablePenalty`, `WebpageUnavailablePenalty`, `WebServer404Penalty` - Node observations can now be configured to show the number of active local and remote logins. -- Ports and IP Protocolsno longer use enums. They are defined in dictionary lookups and are handled by custom validation to enable extendability with plugins. -- Changed AirSpaceFrequency to a data transfer object with a registry to allow extendability +- Ports and IP Protocols no longer use enums. They are defined in dictionary lookups and are handled by custom validation to enable extensibility with plugins. +- Changed AirSpaceFrequency to a data transfer object with a registry to allow extensibility - Changed the Office LAN creation convenience function to follow the new `NetworkNodeAdder` pattern. Office LANs can now also be defined in YAML config. ### Fixed diff --git a/docs/source/node_sets.rst b/docs/source/node_sets.rst index 2a1f74ce..866f0139 100644 --- a/docs/source/node_sets.rst +++ b/docs/source/node_sets.rst @@ -93,7 +93,7 @@ Here is an example of creating a custom node adder, DataCenterAdder: for i in range(config.num_servers): server = Computer( hostname=f"server_{i}_{config.data_center_name}", - ip_address=f"192.168.100.{i + 1}", + ip_address=f"192.168.100.{i + 8}", subnet_mask="255.255.255.0", default_gateway="192.168.100.1", start_up_duration=0 diff --git a/src/primaite/game/game.py b/src/primaite/game/game.py index f6b5b62c..691ac2a1 100644 --- a/src/primaite/game/game.py +++ b/src/primaite/game/game.py @@ -279,7 +279,7 @@ class PrimaiteGame: n_type = node_cfg["type"] new_node = None - # Handle extended nodes + # Default PrimAITE nodes if n_type == "computer": new_node = Computer( hostname=node_cfg["hostname"], @@ -325,6 +325,7 @@ class PrimaiteGame: if not (p := node_cfg.get("operating_state")) else NodeOperatingState[p.upper()], ) + # Handle extended nodes elif n_type.lower() in Node._registry: new_node = HostNode._registry[n_type]( hostname=node_cfg["hostname"], @@ -338,7 +339,6 @@ class PrimaiteGame: ) elif n_type in NetworkNode._registry: new_node = NetworkNode._registry[n_type](**node_cfg) - # Default PrimAITE nodes else: msg = f"invalid node type {n_type} in config" _LOGGER.error(msg)