mirror of https://github.com/MISP/MISP
fix: [stix export] Fixed email attachment export
- Fixed condition trying to reach the case where we have an attachment attribute in the object, which was never true because of a wrong key testing - Fixed the email attachment related file object creation initiationpull/4605/head
parent
62f15433e4
commit
2b23f1e5b7
|
@ -791,9 +791,9 @@ class StixBuilder(object):
|
|||
if 'user-agent' in attributes_dict:
|
||||
email_header.user_agent = attributes_dict['user-agent'][0]['value']
|
||||
email_header.user_agent.condition = "Equals"
|
||||
if 'email-attachment' in attributes_dict:
|
||||
email.attachments = Attachments()
|
||||
for attachment in attributes_dict['email-attachment']:
|
||||
if 'attachment' in attributes_dict:
|
||||
email_object.attachments = Attachments()
|
||||
for attachment in attributes_dict['attachment']:
|
||||
attachment_file = self.create_file_attachment(attachment['value'], attachment['uuid'])
|
||||
email_object.add_related(attachment_file, "Contains", inline=True)
|
||||
email_object.attachments.append(attachment_file.parent.id_)
|
||||
|
@ -1374,7 +1374,8 @@ class StixBuilder(object):
|
|||
return domain_observable
|
||||
|
||||
def create_file_attachment(self, value, uuid):
|
||||
file_object = File(file_name=value)
|
||||
file_object = File()
|
||||
file_object.file_name = value
|
||||
file_object.file_name.condition = "Equals"
|
||||
file_object.parent.id_ = "{}:FileObject-{}".format(self.namespace_prefix, uuid)
|
||||
return file_object
|
||||
|
|
Loading…
Reference in New Issue