From 9c7eded0d053b06edcd447738fe777eb32763d3d Mon Sep 17 00:00:00 2001 From: Ondrej Lukas Date: Tue, 30 Sep 2025 16:27:12 +0200 Subject: [PATCH] Add sorting for ensuring consistency across multiple runs of the coordinator --- AIDojoCoordinator/worlds/WhiteBoxNSGCoordinator.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/AIDojoCoordinator/worlds/WhiteBoxNSGCoordinator.py b/AIDojoCoordinator/worlds/WhiteBoxNSGCoordinator.py index 91573048..88b5e1b7 100644 --- a/AIDojoCoordinator/worlds/WhiteBoxNSGCoordinator.py +++ b/AIDojoCoordinator/worlds/WhiteBoxNSGCoordinator.py @@ -50,6 +50,11 @@ def _generate_all_actions(self)-> list: # Collect all data from all hosts for data in self._data.values(): all_data.update(data) + + # sort all components to have a consistent order + all_ips = sorted(list(all_ips)) + all_networks = sorted(list(all_networks)) + all_data = sorted(list(all_data)) # Network Scans for source_host, target_network in itertools.product(all_ips, all_networks): @@ -71,7 +76,7 @@ def _generate_all_actions(self)-> list: } )) # Service Exploits - for source_host, target_host in itertools.product(all_ips, ip_with_services.keys()): + for source_host, target_host in itertools.product(all_ips, sorted(ip_with_services.keys())): for service in ip_with_services[target_host]: actions.append(Action( ActionType.ExploitService,