fix: Fixed unnecessary dictionary field call

- No longer necessary to go under 'Event' field
  since PyMISP does not contain it since the
  latest update
pull/326/head
chrisr3d 2019-08-05 11:33:04 +02:00
parent 5bf35041cc
commit 0b603fc5d3
No known key found for this signature in database
GPG Key ID: 6BBED1B63A6D639F
6 changed files with 6 additions and 6 deletions

View File

@ -405,7 +405,7 @@ class JoeParser():
def finalize_results(self): def finalize_results(self):
if self.references: if self.references:
self.build_references() self.build_references()
event = json.loads(self.misp_event.to_json())['Event'] event = json.loads(self.misp_event.to_json())
self.results = {key: event[key] for key in ('Attribute', 'Object', 'Tag') if (key in event and event[key])} self.results = {key: event[key] for key in ('Attribute', 'Object', 'Tag') if (key in event and event[key])}
@staticmethod @staticmethod

View File

@ -31,7 +31,7 @@ class VulnerabilityParser():
def get_result(self): def get_result(self):
if self.references: if self.references:
self.__build_references() self.__build_references()
event = json.loads(self.misp_event.to_json())['Event'] event = json.loads(self.misp_event.to_json())
results = {key: event[key] for key in ('Attribute', 'Object') if (key in event and event[key])} results = {key: event[key] for key in ('Attribute', 'Object') if (key in event and event[key])}
return {'results': results} return {'results': results}

View File

@ -31,7 +31,7 @@ class URLhaus():
return vt_object return vt_object
def get_result(self): def get_result(self):
event = json.loads(self.misp_event.to_json())['Event'] event = json.loads(self.misp_event.to_json())
results = {key: event[key] for key in ('Attribute', 'Object') if (key in event and event[key])} results = {key: event[key] for key in ('Attribute', 'Object') if (key in event and event[key])}
return {'results': results} return {'results': results}

View File

@ -35,7 +35,7 @@ class VirusTotalParser(object):
return self.input_types_mapping[self.attribute.type](self.attribute.value, recurse=True) return self.input_types_mapping[self.attribute.type](self.attribute.value, recurse=True)
def get_result(self): def get_result(self):
event = json.loads(self.misp_event.to_json())['Event'] event = json.loads(self.misp_event.to_json())
results = {key: event[key] for key in ('Attribute', 'Object') if (key in event and event[key])} results = {key: event[key] for key in ('Attribute', 'Object') if (key in event and event[key])}
return {'results': results} return {'results': results}

View File

@ -23,7 +23,7 @@ class VirusTotalParser():
self.apikey = apikey self.apikey = apikey
def get_result(self): def get_result(self):
event = json.loads(self.misp_event.to_json())['Event'] event = json.loads(self.misp_event.to_json())
results = {key: event[key] for key in ('Attribute', 'Object') if (key in event and event[key])} results = {key: event[key] for key in ('Attribute', 'Object') if (key in event and event[key])}
return {'results': results} return {'results': results}

View File

@ -194,7 +194,7 @@ class CsvParser():
return list2pop, misp, list(reversed(head)) return list2pop, misp, list(reversed(head))
def finalize_results(self): def finalize_results(self):
event = json.loads(self.misp_event.to_json())['Event'] event = json.loads(self.misp_event.to_json())
self.results = {key: event[key] for key in ('Attribute', 'Object') if (key in event and event[key])} self.results = {key: event[key] for key in ('Attribute', 'Object') if (key in event and event[key])}