From e2cebd6c3e1e11b9a86a0965f673f96365ab8881 Mon Sep 17 00:00:00 2001 From: chrisr3d Date: Tue, 25 Sep 2018 17:10:19 +0200 Subject: [PATCH] fix: Catching errors while parsing additional info in requests --- misp_modules/modules/expansion/virustotal.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/misp_modules/modules/expansion/virustotal.py b/misp_modules/modules/expansion/virustotal.py index 524bc49..d92ede1 100644 --- a/misp_modules/modules/expansion/virustotal.py +++ b/misp_modules/modules/expansion/virustotal.py @@ -134,7 +134,10 @@ class VirusTotalRequest(object): # Go through euch key and check if it exists for VT_type, MISP_type in self.output_types_mapping.items(): if VT_type in data: - self.results[((MISP_type,), comment.format(h))].add(data[VT_type]) + try: + self.results[((MISP_type,), comment.format(h))].add(data[VT_type]) + except TypeError: + self.results[((MISP_type,), comment.format(h))].update(data[VT_type]) # Get the malware sample sample = requests.get(self.base_url[:-6].format('file/download'), params={'hash': h, 'apikey': self.apikey}) malsample = sample.content