fix: Avoid adding file object twice if a KeyError exception comes for some unexpected reasons

pull/322/head
chrisr3d 3 years ago
parent ddeb04bd74
commit 3d41104d5b
No known key found for this signature in database
GPG Key ID: 6BBED1B63A6D639F
  1. 7
      misp_modules/lib/joe_parser.py

@ -217,10 +217,11 @@ class JoeParser():
for field, mapping in file_object_mapping.items():
attribute_type, object_relation = mapping
file_object.add_attribute(object_relation, **{'type': attribute_type, 'value': fileinfo[field]})
try:
to_call = arch_type_mapping[self.data['generalinfo']['arch']]
arch = self.data['generalinfo']['arch']
if arch in arch_type_mapping:
to_call = arch_type_mapping[arch]
getattr(self, to_call)(fileinfo, file_object)
except KeyError:
else:
self.misp_event.add_object(**file_object)
def parse_apk(self, fileinfo, file_object):

Loading…
Cancel
Save