fix: Catching errors while parsing additional info in requests

pull/239/head
chrisr3d 2018-09-25 17:10:19 +02:00
parent e78e45eb0a
commit e2cebd6c3e
No known key found for this signature in database
GPG Key ID: 6BBED1B63A6D639F
1 changed files with 4 additions and 1 deletions

View File

@ -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