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

Fix a bug where all groups/campaigns are returned from case insensitive search of get_group_by_alias/get_campaign_by_alias #80

Merged
merged 2 commits into from
Apr 9, 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
8 changes: 4 additions & 4 deletions attackcti/attack_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1558,8 +1558,8 @@ def get_campaign_by_alias(self, alias: str, case: bool = True, stix_format: bool
all_campaigns_list = list()
for campaign in all_campaigns:
if "aliases" in campaign.keys():
for alias in campaign['aliases']:
if alias.lower() in alias.lower():
for campaign_alias in campaign['aliases']:
if alias.lower() in campaign_alias.lower():
all_campaigns_list.append(campaign)
else:
filter_objects = [
Expand Down Expand Up @@ -1592,8 +1592,8 @@ def get_group_by_alias(self, alias: str, case: bool = True, stix_format: bool =
all_groups_list = list()
for group in all_groups:
if "aliases" in group.keys():
for alias in group['aliases']:
if alias.lower() in alias.lower():
for group_alias in group['aliases']:
if alias.lower() in group_alias.lower():
all_groups_list.append(group)
else:
filter_objects = [
Expand Down