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,10 +33,14 @@ 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):
|
||||||
error = self.input_types_mapping[attribute_type](attribute_value)
|
for attribute_type, attribute_value in q.items():
|
||||||
if error is not None:
|
try:
|
||||||
return error
|
error = self.input_types_mapping[attribute_type](attribute_value)
|
||||||
|
except KeyError:
|
||||||
|
continue
|
||||||
|
if error is not None:
|
||||||
|
return error
|
||||||
for key, values in self.results.items():
|
for key, values in self.results.items():
|
||||||
if isinstance(key, tuple):
|
if isinstance(key, tuple):
|
||||||
types, comment = key
|
types, comment = key
|
||||||
|
@ -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