mirror of https://github.com/MISP/misp-modules
parent
2b94f73c15
commit
3372ee508e
|
@ -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")
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue