mirror of https://github.com/MISP/misp-modules
chg: [config] queries limit
parent
99e2ce7f04
commit
dcc790f5af
|
@ -3,7 +3,7 @@ import json
|
||||||
from queue import Queue
|
from queue import Queue
|
||||||
from threading import Thread
|
from threading import Thread
|
||||||
from uuid import uuid4
|
from uuid import uuid4
|
||||||
from .utils.utils import query_post_query, query_get_module, get_object
|
from .utils.utils import query_post_query, query_get_module, get_object, get_limit_queries
|
||||||
from . import home_core as HomeModel
|
from . import home_core as HomeModel
|
||||||
import uuid
|
import uuid
|
||||||
from . import db
|
from . import db
|
||||||
|
@ -179,7 +179,7 @@ class Session_class:
|
||||||
|
|
||||||
histories = History.query.all()
|
histories = History.query.all()
|
||||||
|
|
||||||
while len(histories) > 200:
|
while len(histories) > get_limit_queries():
|
||||||
history = History.query.order_by(History.id).all()
|
history = History.query.order_by(History.id).all()
|
||||||
session = Session_db.query.filter_by(id=history[0].session_id)
|
session = Session_db.query.filter_by(id=history[0].session_id)
|
||||||
if not History_Tree.query.filter_by(session_uuid=session.uuid):
|
if not History_Tree.query.filter_by(session_uuid=session.uuid):
|
||||||
|
|
|
@ -71,4 +71,7 @@ def gen_admin_password():
|
||||||
print(f"##########################\n## Admin password ##\n## {password} ##\n##########################")
|
print(f"##########################\n## Admin password ##\n## {password} ##\n##########################")
|
||||||
config["ADMIN"]["ADMIN_PASSWORD"] = password
|
config["ADMIN"]["ADMIN_PASSWORD"] = password
|
||||||
with open(CONF_PATH, "w") as conffile:
|
with open(CONF_PATH, "w") as conffile:
|
||||||
config.write(conffile)
|
config.write(conffile)
|
||||||
|
|
||||||
|
def get_limit_queries():
|
||||||
|
return Config.QUERIES_LIMIT
|
|
@ -4,6 +4,8 @@ class Config:
|
||||||
FLASK_URL = '127.0.0.1'
|
FLASK_URL = '127.0.0.1'
|
||||||
FLASK_PORT = 7008
|
FLASK_PORT = 7008
|
||||||
MISP_MODULE = '127.0.0.1:6666'
|
MISP_MODULE = '127.0.0.1:6666'
|
||||||
|
|
||||||
|
QUERIES_LIMIT = 200
|
||||||
|
|
||||||
class DevelopmentConfig(Config):
|
class DevelopmentConfig(Config):
|
||||||
DEBUG = True
|
DEBUG = True
|
||||||
|
|
Loading…
Reference in New Issue