Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make sure correct errors thrown when adding attacker with 'bad' entry… #77

Merged
merged 1 commit into from
Sep 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions maltoolbox/attackgraph/attackgraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,10 @@ def _from_dict(
attacker = ag_attacker,
attacker_id = int(attacker['id']),
entry_points = attacker['entry_points'].keys(),
reached_attack_steps = attacker['reached_attack_steps'].keys()
reached_attack_steps = [
int(node_id) # Convert to int since they can be strings
for node_id in attacker['reached_attack_steps'].keys()
]
)

return attack_graph
Expand Down Expand Up @@ -653,7 +656,7 @@ def add_attacker(

self.next_attacker_id = max(attacker.id + 1, self.next_attacker_id)
for node_id in reached_attack_steps:
node = self.get_node_by_id(int(node_id))
node = self.get_node_by_id(node_id)
if node:
attacker.compromise(node)
else:
Expand Down
Loading