fix: Testing if an object is not empty before adding it the the event

pull/308/head
chrisr3d 2019-06-18 09:45:59 +02:00
parent 9fdd6c5e58
commit 9e45d302b1
No known key found for this signature in database
GPG Key ID: 6BBED1B63A6D639F
1 changed files with 4 additions and 2 deletions

View File

@ -79,6 +79,7 @@ class PayloadQuery(URLhaus):
file_object.add_reference(attribute.uuid, 'retrieved-from')
if url[_filename_]:
file_object.add_attribute(_filename_, **{'type': _filename_, 'value': url[_filename_]})
if any((file_object.attributes, file_object.references)):
self.misp_event.add_object(**file_object)
@ -106,6 +107,7 @@ class UrlQuery(URLhaus):
vt_object = self._create_vt_object(payload['virustotal'])
file_object.add_reference(vt_object.uuid, 'analyzed-with')
self.misp_event.add_object(**vt_object)
if any((file_object.attributes, file_object.references)):
self.misp_event.add_object(**file_object)