chg: [website] screen for misp-module

pull/659/head v2.4.186
David Cruciani 2024-02-27 11:21:49 +01:00
parent 2b94f73c15
commit 3372ee508e
No known key found for this signature in database
GPG Key ID: 8690CDE1E3994B9B
2 changed files with 24 additions and 0 deletions

View File

@ -4,6 +4,18 @@ from flask import render_template
import os
from app.utils.init_modules import create_modules_db
import signal
import sys
import subprocess
def signal_handler(sig, frame):
path = os.path.join(os.getcwd(), "launch.sh")
req = [path, "-ks"]
subprocess.call(req)
sys.exit(0)
signal.signal(signal.SIGINT, signal_handler)
parser = argparse.ArgumentParser()
parser.add_argument("-i", "--init_db", help="Initialise the db if it not exist", action="store_true")

View File

@ -1,8 +1,18 @@
#!/bin/bash
isscripted=`screen -ls | egrep '[0-9]+.misp_mod' | cut -d. -f1`
function killscript {
if [ $isscripted ]; then
screen -X -S misp_mod quit
fi
}
function launch {
export FLASKENV="development"
killscript
screen -dmS "misp_mod"
screen -S "misp_mod" -X screen -t "misp_modules_server" bash -c "../env/bin/misp-modules -l 127.0.0.1; read x"
sleep 2
python3 app.py -m
python3 app.py
}
@ -30,6 +40,8 @@ if [ "$1" ]; then
-r | --reload_db ) reload_db;
;;
-t | --test ) test;
;;
-ks | --killscript ) killscript;
esac
shift
else