From e4d96bd1984345ee45c0e7870624530ef4e82a2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Vinot?= Date: Mon, 24 Aug 2015 12:05:49 +0200 Subject: [PATCH] Fix download of samples with the new archive format. --- pymisp/api.py | 7 ++++++- setup.py | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/pymisp/api.py b/pymisp/api.py index 64c1029..3daec5e 100644 --- a/pymisp/api.py +++ b/pymisp/api.py @@ -320,7 +320,12 @@ class PyMISP(object): for f in result['result']: zipped = StringIO.StringIO(base64.b64decode(f['base64'])) archive = zipfile.ZipFile(zipped) - unzipped = StringIO.StringIO(archive.open(f['md5'], pwd='infected').read()) + try: + # New format + unzipped = StringIO.StringIO(archive.open(f['filename'], pwd='infected').read()) + except KeyError: + # Old format + unzipped = StringIO.StringIO(archive.open(f['md5'], pwd='infected').read()) details.append([f['event_id'], f['filename'], unzipped]) return True, details diff --git a/setup.py b/setup.py index 2c82059..02ef356 100644 --- a/setup.py +++ b/setup.py @@ -4,7 +4,7 @@ from setuptools import setup setup( name='pymisp', - version='1.6', + version='1.7', author='Raphaël Vinot', author_email='raphael.vinot@circl.lu', maintainer='Raphaël Vinot',