cage-challenge / CybORG

Cyber Operations Research Gym
Other
63 stars 26 forks source link

[bug]true_obs_to_table:KeyError #39

Closed tangyunlong closed 1 year ago

tangyunlong commented 1 year ago

I run the following code with reference to the 4th tutorial debug: from CybORG.Agents.Wrappers.TrueTableWrapper import true_obs_to_table

true_table = true_obs_to_table(true_state,env) print(true_table)

The error is as follows: 1 from CybORG.Agents.Wrappers.TrueTableWrapper import true_obs_to_table ----> 3 true_table = true_obs_to_table(true_state,env) 4 print(true_table)

File ~/pettingzooAndOrg/cage-challenge-3/CybORG/CybORG/Agents/Wrappers/TrueTableWrapper.py:118, in true_obs_to_table(true_obs, env) 116 wrapper = TrueTableWrapper(env,observer_mode=False) 117 wrapper.step_counter = 1 --> 118 return wrapper.observation_change(agent=None, observation=true_obs)

File ~/pettingzooAndOrg/cage-challenge-3/CybORG/CybORG/Agents/Wrappers/TrueTableWrapper.py:26, in TrueTableWrapper.observation_change(self, agent, observation) 23 self.step_counter +=1 24 self._update_scanned() ---> 26 return observation if self.observer_mode else self._create_true_table()

File ~/pettingzooAndOrg/cage-challenge-3/CybORG/CybORG/Agents/Wrappers/TrueTableWrapper.py:68, in TrueTableWrapper._create_true_table(self) 66 hostname = host['System info']['Hostname'] 67 action_space = self.get_action_space(agent = 'Red') ---> 68 known = action_space['ip_address'][ip] 69 scanned = True if str(ip) in self.scanned_ips else False 70 access = self._determine_red_access(host['Sessions'])

KeyError: IPv4Address('10.0.214.136')

I don't know what this ‘key error’ stands for and how to fix it

djbow2 commented 1 year ago

Note this wrapper is no longer supported.

Is it possible the environment was reset before calling this method? The stated ip address is not in the action_space, which indicates this may be the case?

tangyunlong commented 1 year ago

Thanks a lot,I would consider using using the pettingzoo wrapper to bypass this issue.