mirror of https://github.com/MISP/PyMISP
add attributes within objects as well, for tagging via value/id/uuid
parent
9f453e98fa
commit
443acd9a47
|
@ -569,13 +569,14 @@ class MISPEvent(AbstractMISP):
|
||||||
:attribute_identifier: can be an ID, UUID, or the value.
|
:attribute_identifier: can be an ID, UUID, or the value.
|
||||||
'''
|
'''
|
||||||
attributes = []
|
attributes = []
|
||||||
for a in self.attributes:
|
for a in self.attributes + [attribute for o in self.objects for attribute in o.attributes]:
|
||||||
if ((hasattr(a, 'id') and a.id == attribute_identifier) or
|
if ((hasattr(a, 'id') and a.id == attribute_identifier) or
|
||||||
(hasattr(a, 'uuid') and a.uuid == attribute_identifier) or
|
(hasattr(a, 'uuid') and a.uuid == attribute_identifier) or
|
||||||
(hasattr(a, 'value') and attribute_identifier == a.value or
|
(hasattr(a, 'value') and attribute_identifier == a.value or
|
||||||
attribute_identifier in a.value.split('|'))):
|
attribute_identifier in a.value.split('|'))):
|
||||||
a.add_tag(tag)
|
a.add_tag(tag)
|
||||||
attributes.append(a)
|
attributes.append(a)
|
||||||
|
|
||||||
if not attributes:
|
if not attributes:
|
||||||
raise Exception('No attribute with identifier {} found.'.format(attribute_identifier))
|
raise Exception('No attribute with identifier {} found.'.format(attribute_identifier))
|
||||||
self.edited = True
|
self.edited = True
|
||||||
|
|
Loading…
Reference in New Issue