Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def mitigations(self):
"""Creates AttckMitigation objects
Returns:
(AttckMitigation) -- (Returns a list of AttckMitigation objects)
"""
mitigation_list = []
for mitigation in self.attck['objects']:
if mitigation['type'] == 'course-of-action':
mitigation_list.append(AttckMitigation(attck_obj=self.attck, **mitigation))
return mitigation_list
def __init__(self, attck_obj = None, **kwargs):
"""Creates an AttckTactic object.
The AttckMitigation object is considered a list of mitigations to threats based on the Mitre ATT&CK Framework
"""
self.attck_obj = attck_obj
self.created_by_ref = super(AttckMitigation, self)._set_attribute(kwargs, 'created_by_ref')
self.id = super(AttckMitigation, self)._set_id(kwargs)
self.name = super(AttckMitigation, self)._set_attribute(kwargs, 'name')
self.description = super(AttckMitigation, self)._set_attribute(kwargs, 'description')
self.external_reference = super(AttckMitigation, self)._set_reference(kwargs)
self.created = super(AttckMitigation, self)._set_attribute(kwargs, 'created')
self.modified = super(AttckMitigation, self)._set_attribute(kwargs, 'modified')
self.stix = super(AttckMitigation, self)._set_attribute(kwargs, 'id')
self.type = super(AttckMitigation, self)._set_attribute(kwargs, 'type')
self.wiki = super(AttckMitigation, self)._set_wiki(kwargs)
def mitigation(self):
'''Returns all mitigation objects as a list that are documented to help mitigate the current technique object'''
from .mitigation import AttckMitigation
mitigation_list = []
for item in self.attck_obj['objects']:
if 'relationship_type' in item:
if 'mitigates' in item['relationship_type']:
if self.stix in item['target_ref']:
for o in self.attck_obj['objects']:
if item['source_ref'] in o['id']:
mitigation_list.append(AttckMitigation(**o))
return mitigation_list