mirror of https://github.com/MISP/misp-modules
fix: Multiple attributes parsing support
- Fixing one of my previous changes not processing multiple attributes parsingpull/222/head
parent
2af947a2de
commit
936e30b15b
|
@ -33,8 +33,12 @@ class VirusTotalRequest(object):
|
||||||
self.output_types_mapping = {'submission_names': 'filename', 'ssdeep': 'ssdeep',
|
self.output_types_mapping = {'submission_names': 'filename', 'ssdeep': 'ssdeep',
|
||||||
'authentihash': 'authentihash', 'ITW_urls': 'url'}
|
'authentihash': 'authentihash', 'ITW_urls': 'url'}
|
||||||
|
|
||||||
def parse_request(self, attribute_type, attribute_value):
|
def parse_request(self, q):
|
||||||
|
for attribute_type, attribute_value in q.items():
|
||||||
|
try:
|
||||||
error = self.input_types_mapping[attribute_type](attribute_value)
|
error = self.input_types_mapping[attribute_type](attribute_value)
|
||||||
|
except KeyError:
|
||||||
|
continue
|
||||||
if error is not None:
|
if error is not None:
|
||||||
return error
|
return error
|
||||||
for key, values in self.results.items():
|
for key, values in self.results.items():
|
||||||
|
@ -144,7 +148,7 @@ def handler(q=False):
|
||||||
return misperrors
|
return misperrors
|
||||||
del q['module']
|
del q['module']
|
||||||
query = VirusTotalRequest(q.pop('config'))
|
query = VirusTotalRequest(q.pop('config'))
|
||||||
r = query.parse_request(*list(q.items())[0])
|
r = query.parse_request(q)
|
||||||
if isinstance(r, str):
|
if isinstance(r, str):
|
||||||
misperrors['error'] = r
|
misperrors['error'] = r
|
||||||
return misperrors
|
return misperrors
|
||||||
|
|
Loading…
Reference in New Issue