mirror of https://github.com/MISP/PyMISP
fix: Better warning if lief is outdated.
parent
e93337e75c
commit
c5c1d84bcf
|
@ -1,7 +1,6 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import sys
|
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
|
|
||||||
from . import FileObject
|
from . import FileObject
|
||||||
|
@ -20,8 +19,13 @@ try:
|
||||||
from .elfobject import make_elf_objects
|
from .elfobject import make_elf_objects
|
||||||
from .machoobject import make_macho_objects
|
from .machoobject import make_macho_objects
|
||||||
|
|
||||||
|
except AttributeError:
|
||||||
|
HAS_LIEF = False
|
||||||
|
logger.critical('You need lief >= 0.11.0. The quick and dirty fix is: pip3 install --force pymisp[fileobjects]')
|
||||||
|
|
||||||
except ImportError:
|
except ImportError:
|
||||||
HAS_LIEF = False
|
HAS_LIEF = False
|
||||||
|
logger.critical('You need lief >= 0.11.0. The quick and dirty fix is: pip3 install --force pymisp[fileobjects]')
|
||||||
|
|
||||||
|
|
||||||
class FileTypeNotImplemented(MISPObjectException):
|
class FileTypeNotImplemented(MISPObjectException):
|
||||||
|
@ -36,10 +40,6 @@ def make_binary_objects(filepath: Optional[str] = None, pseudofile: Optional[Byt
|
||||||
if filepath:
|
if filepath:
|
||||||
lief_parsed = lief.parse(filepath=filepath)
|
lief_parsed = lief.parse(filepath=filepath)
|
||||||
elif pseudofile and filename:
|
elif pseudofile and filename:
|
||||||
if sys.version_info < (3, 0):
|
|
||||||
logger.critical('Pseudofile is not supported in python2. Just update.')
|
|
||||||
lief_parsed = None
|
|
||||||
else:
|
|
||||||
lief_parsed = lief.parse(raw=pseudofile.getvalue(), name=filename)
|
lief_parsed = lief.parse(raw=pseudofile.getvalue(), name=filename)
|
||||||
else:
|
else:
|
||||||
logger.critical('You need either a filepath, or a pseudofile and a filename.')
|
logger.critical('You need either a filepath, or a pseudofile and a filename.')
|
||||||
|
|
Loading…
Reference in New Issue