Skip to content

Commit 732d7d1

Browse files
authored
Merge pull request #269 from stratosphereips/fix-reward-conf
Fix the names of the rewards in the configuration
2 parents 0d45f73 + e240f75 commit 732d7d1

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

AIDojoCoordinator/coordinator.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,8 @@ async def _fetch_initialization_objects(self):
206206
self.logger.error(f"Failed to fetch initialization objects. Status: {response.status}")
207207
except Exception as e:
208208
self.logger.error(f"Error fetching initialization objects: {e}")
209-
209+
# Temporary fix
210+
self.task_config = ConfigParser(self._task_config_file)
210211
def _load_initialization_objects(self)->None:
211212
"""
212213
Loads task configuration from a local file.
@@ -330,8 +331,8 @@ async def start_tasks(self):
330331
else:
331332
self._global_defender = None
332333
self._use_dynamic_ips = self.task_config.get_use_dynamic_addresses()
333-
self._rewards = self.task_config.get_rewards(["step", "sucess", "fail"])
334-
self.logger.debug(f"Rewards set to:{self._rewards}")
334+
self._rewards = self.task_config.get_rewards(["step", "success", "fail"])
335+
self.logger.info(f"Rewards set to:{self._rewards}")
335336

336337
# start server for agent communication
337338
self._spawn_task(self.start_tcp_server)
@@ -587,7 +588,7 @@ async def _assign_rewards_episode_end(self):
587588
for agent in attackers:
588589
self.logger.debug(f"Processing reward for agent {agent}")
589590
if self._agent_status[agent] is AgentStatus.Success:
590-
self._agent_rewards[agent] += self._rewards["sucess"]
591+
self._agent_rewards[agent] += self._rewards["success"]
591592
successful_attack = True
592593
else:
593594
self._agent_rewards[agent] += self._rewards["fail"]
@@ -596,7 +597,7 @@ async def _assign_rewards_episode_end(self):
596597
for agent in defenders:
597598
self.logger.debug(f"Processing reward for agent {agent}")
598599
if not successful_attack:
599-
self._agent_rewards[agent] += self._rewards["sucess"]
600+
self._agent_rewards[agent] += self._rewards["success"]
600601
self._agent_status[agent] = AgentStatus.Success
601602
else:
602603
self._agent_rewards[agent] += self._rewards["fail"]

AIDojoCoordinator/netsecenv_conf.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ coordinator:
44
# Define the conf for all the 'attacker' agents.
55
agents:
66
Attacker:
7-
max_steps: 20
7+
max_steps: 25
88
goal:
99
description: "Exfiltrate data to '213.47.23.195'"
1010
is_any_part_of_goal_random: True
@@ -103,9 +103,9 @@ env:
103103
use_firewall: True
104104
save_trajectories: False
105105
rewards:
106-
win: 100
106+
success: 100
107107
step: -1
108-
loss: -10
108+
fail: -10
109109
actions:
110110
scan_network:
111111
prob_success: 1.0

0 commit comments

Comments
 (0)