Skip to content

Commit

Permalink
fix: Adding better logic to filter out multiple tactics
Browse files Browse the repository at this point in the history
  • Loading branch information
MSAdministrator committed Feb 10, 2023
1 parent ba3193a commit 7769690
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/pyattck_data/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,15 @@ def _get_relationship_objects(self, parent_id: str, parent_type: str) -> list:
return return_list

def _get_tactic_objects(self, name):
return_list = []
return_set = set()
for item in BASE_OBJECTS:
if item.type == "x-mitre-tactic":
if hasattr(item, "x_mitre_shortname") and item.x_mitre_shortname == name.lower():
return_set.add(item)
return list(return_set)
if item.x_mitre_shortname not in return_set:
return_set.add(item.x_mitre_shortname)
return_list.append(item)
return return_list

def __attrs_post_init__(self):
if self.external_references:
Expand Down

0 comments on commit 7769690

Please sign in to comment.