mirror of https://github.com/CIRCL/lookyloo
fix: add warning if MISP module is enabled, but instance unreachable.
parent
c358c08640
commit
60ad0dc7ce
|
@ -22,14 +22,23 @@ from pymisp import PyMISP, MISPEvent
|
||||||
class MISP():
|
class MISP():
|
||||||
|
|
||||||
def __init__(self, config: Dict[str, Any]):
|
def __init__(self, config: Dict[str, Any]):
|
||||||
|
self.logger = logging.getLogger(f'{self.__class__.__name__}')
|
||||||
|
self.logger.setLevel(get_config('generic', 'loglevel'))
|
||||||
if not config.get('apikey'):
|
if not config.get('apikey'):
|
||||||
self.available = False
|
self.available = False
|
||||||
|
self.logger.info('Module not enabled.')
|
||||||
return
|
return
|
||||||
|
|
||||||
self.available = True
|
self.available = True
|
||||||
self.enable_lookup = False
|
self.enable_lookup = False
|
||||||
self.enable_push = False
|
self.enable_push = False
|
||||||
self.client = PyMISP(url=config['url'], key=config['apikey'], ssl=config['verify_tls_cert'])
|
try:
|
||||||
|
self.client = PyMISP(url=config['url'], key=config['apikey'], ssl=config['verify_tls_cert'])
|
||||||
|
except Exception as e:
|
||||||
|
self.available = False
|
||||||
|
self.logger.warning(f'Unable to connect to MISP: {e}')
|
||||||
|
return
|
||||||
|
|
||||||
if config.get('enable_lookup'):
|
if config.get('enable_lookup'):
|
||||||
self.enable_lookup = True
|
self.enable_lookup = True
|
||||||
if config.get('enable_push'):
|
if config.get('enable_push'):
|
||||||
|
|
Loading…
Reference in New Issue