-
Notifications
You must be signed in to change notification settings - Fork 556
[CrowdStrike] Add motivations and adversary type as labels on IntrusionSet #6129
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
base: master
Are you sure you want to change the base?
Changes from 2 commits
07fe37c
37cc2c8
0fa1e75
cbcfce4
55a4823
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,12 +4,6 @@ | |
| from collections.abc import Mapping | ||
| from typing import Any, cast | ||
|
|
||
| from crowdstrike_feeds_services.utils import ( | ||
| create_external_reference, | ||
| create_intrusion_set, | ||
| normalize_start_time_and_stop_time, | ||
| timestamp_to_datetime, | ||
| ) | ||
| from stix2 import ( | ||
| AttackPattern, | ||
| ExternalReference, | ||
|
|
@@ -18,6 +12,13 @@ | |
| MarkingDefinition, | ||
| ) | ||
|
|
||
| from crowdstrike_feeds_services.utils import ( | ||
| create_external_reference, | ||
| create_intrusion_set, | ||
| normalize_start_time_and_stop_time, | ||
| timestamp_to_datetime, | ||
| ) | ||
|
|
||
| logger = logging.getLogger(__name__) | ||
|
|
||
|
|
||
|
|
@@ -253,6 +254,21 @@ def _create_intrusion_set_from_actor_entity( | |
| ) | ||
| ) | ||
|
|
||
| # Labels: raw CrowdStrike motivation values and actor_type | ||
| labels: list[str] = [] | ||
| for mot in motivations_raw: | ||
| if isinstance(mot, Mapping): | ||
| val = str(mot.get("value") or mot.get("slug") or "").strip() | ||
| else: | ||
| val = str(mot).strip() | ||
| if val: | ||
| labels.append(val) | ||
| actor_type = actor.get("actor_type") | ||
| if actor_type: | ||
| actor_type_str = str(actor_type).strip() | ||
| if actor_type_str: | ||
| labels.append(actor_type_str) | ||
|
|
||
|
Comment on lines
+256
to
+271
|
||
| return create_intrusion_set( | ||
| name, | ||
| created_by=created_by, | ||
|
|
@@ -263,6 +279,7 @@ def _create_intrusion_set_from_actor_entity( | |
| goals=goals or None, | ||
| primary_motivation=primary_motivation, | ||
| secondary_motivations=secondary_motivations or None, | ||
| labels=labels or None, | ||
| confidence=confidence, | ||
| external_references=external_references or None, | ||
| object_markings=object_markings, | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.