mirror of https://github.com/CIRCL/AIL-framework
fix: [core] fix instance ail:uuid
parent
8ec4370043
commit
2ae3ffd6d2
|
@ -10,13 +10,23 @@ Init DB + Clear Stats
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
import logging.config
|
||||||
|
|
||||||
sys.path.append(os.environ['AIL_BIN'])
|
sys.path.append(os.environ['AIL_BIN'])
|
||||||
##################################
|
##################################
|
||||||
# Import Project packages
|
# Import Project packages
|
||||||
##################################
|
##################################
|
||||||
|
from lib import ail_core
|
||||||
from lib import ail_queues
|
from lib import ail_queues
|
||||||
|
from lib import ail_logger
|
||||||
|
|
||||||
|
logging.config.dictConfig(ail_logger.get_config(name='modules'))
|
||||||
|
logger = logging.getLogger()
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
ail_queues.save_queue_digraph()
|
ail_queues.save_queue_digraph()
|
||||||
ail_queues.clear_modules_queues_stats()
|
ail_queues.clear_modules_queues_stats()
|
||||||
|
|
||||||
|
# Send module state to logs
|
||||||
|
ail_uuid = ail_core.get_ail_uuid()
|
||||||
|
logger.warning(f"AIL {ail_uuid} started")
|
||||||
|
|
|
@ -18,7 +18,15 @@ config_loader = None
|
||||||
AIL_OBJECTS = sorted({'cve', 'cryptocurrency', 'decoded', 'domain', 'item', 'pgp', 'screenshot', 'username'})
|
AIL_OBJECTS = sorted({'cve', 'cryptocurrency', 'decoded', 'domain', 'item', 'pgp', 'screenshot', 'username'})
|
||||||
|
|
||||||
def get_ail_uuid():
|
def get_ail_uuid():
|
||||||
return r_serv_db.get('ail:uuid')
|
ail_uuid = r_serv_db.get('ail:uuid')
|
||||||
|
if not ail_uuid:
|
||||||
|
ail_uuid = _set_ail_uuid()
|
||||||
|
return ail_uuid
|
||||||
|
|
||||||
|
def _set_ail_uuid():
|
||||||
|
ail_uuid = generate_uuid()
|
||||||
|
r_serv_db.set('ail:uuid', ail_uuid)
|
||||||
|
return ail_uuid
|
||||||
|
|
||||||
def generate_uuid():
|
def generate_uuid():
|
||||||
return str(uuid4())
|
return str(uuid4())
|
||||||
|
|
|
@ -68,8 +68,6 @@ class Global(AbstractModule):
|
||||||
|
|
||||||
# Send module state to logs
|
# Send module state to logs
|
||||||
self.logger.info(f"Module {self.module_name} initialized")
|
self.logger.info(f"Module {self.module_name} initialized")
|
||||||
# Send module state to logs # TODO MOVE ME IN INIT SCRIPT
|
|
||||||
self.redis_logger.critical(f"AIL {get_ail_uuid()} started")
|
|
||||||
|
|
||||||
def computeNone(self):
|
def computeNone(self):
|
||||||
difftime = time.time() - self.time_last_stats
|
difftime = time.time() - self.time_last_stats
|
||||||
|
|
Loading…
Reference in New Issue