2018-03-23 10:05:27 +01:00
|
|
|
__version__ = '2.4.89'
|
2017-11-08 03:10:04 +01:00
|
|
|
import logging
|
2017-12-22 14:49:14 +01:00
|
|
|
import functools
|
|
|
|
import warnings
|
|
|
|
|
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
|
|
|
|
|
|
|
def deprecated(func):
|
|
|
|
'''This is a decorator which can be used to mark functions
|
|
|
|
as deprecated. It will result in a warning being emitted
|
|
|
|
when the function is used.'''
|
|
|
|
|
|
|
|
@functools.wraps(func)
|
|
|
|
def new_func(*args, **kwargs):
|
|
|
|
warnings.showwarning(
|
|
|
|
"Call to deprecated function {}.".format(func.__name__),
|
|
|
|
category=DeprecationWarning,
|
|
|
|
filename=func.__code__.co_filename,
|
|
|
|
lineno=func.__code__.co_firstlineno + 1
|
|
|
|
)
|
|
|
|
return func(*args, **kwargs)
|
|
|
|
return new_func
|
|
|
|
|
|
|
|
|
2017-08-25 16:08:05 +02:00
|
|
|
try:
|
2018-01-08 11:59:32 +01:00
|
|
|
from .exceptions import PyMISPError, NewEventError, NewAttributeError, MissingDependency, NoURL, NoKey, InvalidMISPObject, UnknownMISPObjectTemplate, PyMISPInvalidFormat # noqa
|
2017-08-28 19:01:53 +02:00
|
|
|
from .api import PyMISP # noqa
|
2018-01-08 11:59:32 +01:00
|
|
|
from .abstract import AbstractMISP, MISPEncode, MISPTag # noqa
|
|
|
|
from .mispevent import MISPEvent, MISPAttribute, MISPObjectReference, MISPObjectAttribute, MISPObject, MISPUser, MISPOrganisation, MISPSighting # 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
|
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))
|