mirror of https://github.com/MISP/PyMISP
parent
22e4d58a50
commit
c133713d33
|
@ -12,10 +12,7 @@ try:
|
||||||
from urllib.parse import urljoin
|
from urllib.parse import urljoin
|
||||||
except ImportError:
|
except ImportError:
|
||||||
from urlparse import urljoin
|
from urlparse import urljoin
|
||||||
try:
|
from io import BytesIO
|
||||||
from io import StringIO
|
|
||||||
except ImportError:
|
|
||||||
from StringIO import StringIO
|
|
||||||
import zipfile
|
import zipfile
|
||||||
import warnings
|
import warnings
|
||||||
import functools
|
import functools
|
||||||
|
@ -545,14 +542,17 @@ class PyMISP(object):
|
||||||
return False, result.get('message')
|
return False, result.get('message')
|
||||||
details = []
|
details = []
|
||||||
for f in result['result']:
|
for f in result['result']:
|
||||||
zipped = StringIO(base64.b64decode(f['base64']))
|
decoded = base64.b64decode(f['base64'])
|
||||||
|
#if not isinstance(decoded, unicode):
|
||||||
|
# decoded = decoded.encode('utf-8')
|
||||||
|
zipped = BytesIO(decoded)
|
||||||
archive = zipfile.ZipFile(zipped)
|
archive = zipfile.ZipFile(zipped)
|
||||||
try:
|
try:
|
||||||
# New format
|
# New format
|
||||||
unzipped = StringIO(archive.open(f['md5'], pwd='infected').read())
|
unzipped = BytesIO(archive.open(f['md5'], pwd='infected').read())
|
||||||
except KeyError:
|
except KeyError:
|
||||||
# Old format
|
# Old format
|
||||||
unzipped = StringIO(archive.open(f['filename'], pwd='infected').read())
|
unzipped = BytesIO(archive.open(f['filename'], pwd='infected').read())
|
||||||
details.append([f['event_id'], f['filename'], unzipped])
|
details.append([f['event_id'], f['filename'], unzipped])
|
||||||
return True, details
|
return True, details
|
||||||
|
|
||||||
|
|
2
setup.py
2
setup.py
|
@ -4,7 +4,7 @@ from setuptools import setup
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name='pymisp',
|
name='pymisp',
|
||||||
version='1.8',
|
version='1.8.1',
|
||||||
author='Raphaël Vinot',
|
author='Raphaël Vinot',
|
||||||
author_email='raphael.vinot@circl.lu',
|
author_email='raphael.vinot@circl.lu',
|
||||||
maintainer='Raphaël Vinot',
|
maintainer='Raphaël Vinot',
|
||||||
|
|
Loading…
Reference in New Issue