2019-07-12 16:09:02 +02:00
|
|
|
__version__ = '2.4.111'
|
2017-11-08 03:10:04 +01:00
|
|
|
import logging
|
2017-12-22 14:49:14 +01:00
|
|
|
import warnings
|
2018-08-09 18:11:45 +02:00
|
|
|
import sys
|
2017-12-22 14:49:14 +01:00
|
|
|
|
2017-11-08 04:10:54 +01:00
|
|
|
FORMAT = "%(levelname)s [%(filename)s:%(lineno)s - %(funcName)s() ] %(message)s"
|
2018-01-22 16:42:43 +01:00
|
|
|
formatter = logging.Formatter(FORMAT)
|
|
|
|
default_handler = logging.StreamHandler()
|
|
|
|
default_handler.setFormatter(formatter)
|
|
|
|
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
logger.addHandler(default_handler)
|
|
|
|
logger.setLevel(logging.WARNING)
|
2015-09-18 12:03:56 +02:00
|
|
|
|
2017-12-22 14:49:14 +01:00
|
|
|
|
2019-07-12 17:35:02 +02:00
|
|
|
def warning_2020():
|
2017-12-22 14:49:14 +01:00
|
|
|
|
2019-07-12 17:35:02 +02:00
|
|
|
if sys.version_info < (3, 6):
|
|
|
|
warnings.warn("""
|
|
|
|
Python 2.7 is officially end of life the 2020-01-01. For this occasion,
|
|
|
|
we decided to review which versions of Python we support and our conclusion
|
|
|
|
is to only support python 3.6+ starting the 2020-01-01.
|
|
|
|
|
|
|
|
Every version of pymisp released after the 2020-01-01 will fail if the
|
|
|
|
python interpreter is prior to python 3.6.
|
|
|
|
|
|
|
|
**Please update your codebase.**""", DeprecationWarning, stacklevel=3)
|
2017-12-22 14:49:14 +01:00
|
|
|
|
|
|
|
|
2017-08-25 16:08:05 +02:00
|
|
|
try:
|
2019-07-12 17:35:02 +02:00
|
|
|
warning_2020()
|
2018-12-18 11:04:36 +01:00
|
|
|
from .exceptions import PyMISPError, NewEventError, NewAttributeError, MissingDependency, NoURL, NoKey, InvalidMISPObject, UnknownMISPObjectTemplate, PyMISPInvalidFormat, MISPServerError, PyMISPNotImplementedYet, PyMISPUnexpectedResponse, PyMISPEmptyResponse # noqa
|
2017-08-28 19:01:53 +02:00
|
|
|
from .api import PyMISP # noqa
|
2018-08-09 18:11:45 +02:00
|
|
|
from .abstract import AbstractMISP, MISPEncode, MISPTag, Distribution, ThreatLevel, Analysis # noqa
|
2019-07-12 17:35:02 +02:00
|
|
|
from .mispevent import MISPEvent, MISPAttribute, MISPObjectReference, MISPObjectAttribute, MISPObject, MISPUser, MISPOrganisation, MISPSighting, MISPLog, MISPShadowAttribute, MISPWarninglist, MISPTaxonomy, MISPNoticelist, MISPObjectTemplate, MISPSharingGroup, MISPRole, MISPServer, MISPFeed # noqa
|
2017-09-12 16:46:06 +02:00
|
|
|
from .tools import AbstractMISPObjectGenerator # noqa
|
2017-08-28 19:01:53 +02:00
|
|
|
from .tools import Neo4j # noqa
|
|
|
|
from .tools import stix # noqa
|
2017-09-20 12:24:51 +02:00
|
|
|
from .tools import openioc # noqa
|
2018-01-25 17:56:30 +01:00
|
|
|
from .tools import load_warninglists # noqa
|
2018-01-26 17:02:47 +01:00
|
|
|
from .tools import ext_lookups # noqa
|
2019-02-28 06:16:49 +01:00
|
|
|
|
2019-03-12 16:17:20 +01:00
|
|
|
if sys.version_info >= (3, 6):
|
2019-07-12 17:35:02 +02:00
|
|
|
from .aping import ExpandedPyMISP # noqa
|
2019-03-12 16:17:20 +01:00
|
|
|
# Let's not bother with old python
|
2019-02-28 06:16:49 +01:00
|
|
|
try:
|
|
|
|
from .tools import reportlab_generator # noqa
|
2019-02-28 08:43:49 +01:00
|
|
|
except ImportError:
|
|
|
|
# FIXME: The import should not raise an exception if reportlab isn't installed
|
|
|
|
pass
|
2019-02-28 06:23:59 +01:00
|
|
|
except NameError:
|
2019-02-28 06:16:49 +01:00
|
|
|
# FIXME: The import should not raise an exception if reportlab isn't installed
|
|
|
|
pass
|
2017-11-08 03:10:04 +01:00
|
|
|
logger.debug('pymisp loaded properly')
|
|
|
|
except ImportError as e:
|
|
|
|
logger.warning('Unable to load pymisp properly: {}'.format(e))
|