Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def tactic(self):
'''Returns all tactics as a list that this technique is found in'''
from .tactic import AttckTactic
tactic_list = []
for item in self.attck_obj['objects']:
if 'x-mitre-tactic' in item['type']:
if str(self._tactic).lower() == str(item['x_mitre_shortname']).lower():
tactic_list.append(AttckTactic(**item))
return tactic_list
'''The AttckTactic class is used to gather information about all Mitre ATT&CK Framework Tactics.
To access this class directly you must first instantiate it and provide the appropriate inputs, but it is easier to use the Attck class wrapper.
Args:
attck_obj ([json]): This should be the raw Mitre ATT&CK json object. Defaults to None, but should be provided
'''
self.attck_obj = attck_obj
self.id = super(AttckTactic, self)._set_id(kwargs)
self.created_by_ref = super(AttckTactic, self)._set_attribute(kwargs, 'created_by_ref')
self.type = super(AttckTactic, self)._set_attribute(kwargs, 'type')
self.name = super(AttckTactic, self)._set_attribute(kwargs, 'name')
self.description = super(AttckTactic, self)._set_attribute(kwargs, 'description')
self.external_reference = super(AttckTactic, self)._set_reference(kwargs)
self.created = super(AttckTactic, self)._set_attribute(kwargs, 'created')
self.modified = super(AttckTactic, self)._set_attribute(kwargs, 'modified')
self.stix = super(AttckTactic, self)._set_attribute(kwargs, 'id')
self.short_name = super(AttckTactic, self)._set_attribute(kwargs, 'x_mitre_shortname')
self.wiki = super(AttckTactic, self)._set_wiki(kwargs)
def tactics(self):
"""Creates AttckTactic objects
Returns:
(AttckTactic) -- (Returns a list of AttckTactic objects)
"""
tactic_list = []
for tactic in self.attck['objects']:
if tactic['type'] == 'x-mitre-tactic':
tactic_list.append(AttckTactic(attck_obj=self.attck, **tactic))
return tactic_list