Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
clemiller committed Oct 19, 2023
1 parent c8d6508 commit a84c917
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
14 changes: 6 additions & 8 deletions mitreattack/stix20/MitreAttackData.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class MitreAttackData:
"x-mitre-tactic",
"x-mitre-data-source",
"x-mitre-data-component",
"x-mitre-asset"
"x-mitre-asset",
]

# software:group
Expand Down Expand Up @@ -267,7 +267,7 @@ def get_campaigns(self, remove_revoked_deprecated=False) -> list:
a list of Campaign objects
"""
return self.get_objects_by_type("campaign", remove_revoked_deprecated)

def get_assets(self, remove_revoked_deprecated=False) -> list:
"""Retrieve all asset objects.
Expand Down Expand Up @@ -1715,7 +1715,9 @@ def get_all_techniques_targeting_all_assets(self) -> dict:
if self.all_techniques_targeting_all_assets:
return self.all_techniques_targeting_all_assets

self.all_techniques_targeting_all_assets = self.get_related("attack-pattern", "targets", "x-mitre-asset", reverse=True)
self.all_techniques_targeting_all_assets = self.get_related(
"attack-pattern", "targets", "x-mitre-asset", reverse=True
)

return self.all_techniques_targeting_all_assets

Expand All @@ -1733,11 +1735,7 @@ def get_techniques_targeting_asset(self, asset_stix_id: str) -> list:
a list of {"object": AttackPattern, "relationships": Relationship[]} for each technique targeting the asset
"""
techniques_targeting_assets = self.get_all_techniques_targeting_all_assets()
return (
techniques_targeting_assets[asset_stix_id]
if asset_stix_id in techniques_targeting_assets
else []
)
return techniques_targeting_assets[asset_stix_id] if asset_stix_id in techniques_targeting_assets else []

def get_all_assets_targeted_by_all_techniques(self) -> dict:
"""Get all assets targeted by all techniques.
Expand Down
4 changes: 2 additions & 2 deletions mitreattack/stix20/custom_attack_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
ReferenceProperty,
TimestampProperty,
BooleanProperty,
DictionaryProperty
DictionaryProperty,
)


Expand Down Expand Up @@ -220,7 +220,7 @@ class DataComponent(CustomStixObject, object):
("sectors", ListProperty(StringProperty())),
("x_mitre_related_assets", ListProperty(DictionaryProperty())),
("x_mitre_platforms", ListProperty(StringProperty())),
]
],
)
class Asset(CustomStixObject, object):
"""Custom Asset object of type stix2.CustomObject.
Expand Down

0 comments on commit a84c917

Please sign in to comment.