Skip to content

Commit 787f69e

Browse files
authored
Merge pull request #366 from stratosphereips/ondra-fix-ordering-in-action-list
Add sorting for ensuring consistency across multiple runs of the coordinator
2 parents 2bf9e8b + 9c7eded commit 787f69e

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

AIDojoCoordinator/worlds/WhiteBoxNSGCoordinator.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,11 @@ def _generate_all_actions(self)-> list:
5050
# Collect all data from all hosts
5151
for data in self._data.values():
5252
all_data.update(data)
53+
54+
# sort all components to have a consistent order
55+
all_ips = sorted(list(all_ips))
56+
all_networks = sorted(list(all_networks))
57+
all_data = sorted(list(all_data))
5358

5459
# Network Scans
5560
for source_host, target_network in itertools.product(all_ips, all_networks):
@@ -71,7 +76,7 @@ def _generate_all_actions(self)-> list:
7176
}
7277
))
7378
# Service Exploits
74-
for source_host, target_host in itertools.product(all_ips, ip_with_services.keys()):
79+
for source_host, target_host in itertools.product(all_ips, sorted(ip_with_services.keys())):
7580
for service in ip_with_services[target_host]:
7681
actions.append(Action(
7782
ActionType.ExploitService,

0 commit comments

Comments
 (0)