2014-08-06 11:43:40 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
GREEN="\\033[1;32m"
|
|
|
|
DEFAULT="\\033[0;39m"
|
|
|
|
RED="\\033[1;31m"
|
|
|
|
ROSE="\\033[1;35m"
|
|
|
|
BLUE="\\033[1;34m"
|
|
|
|
WHITE="\\033[0;02m"
|
|
|
|
YELLOW="\\033[1;33m"
|
|
|
|
CYAN="\\033[1;36m"
|
|
|
|
|
2018-11-22 06:57:24 +01:00
|
|
|
# Getting CWD where bash script resides
|
2018-11-22 07:08:59 +01:00
|
|
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd |sed 's/bin//' )"
|
2018-11-22 08:16:31 +01:00
|
|
|
export AIL_HOME="${DIR}"
|
2018-11-22 06:57:24 +01:00
|
|
|
|
|
|
|
cd ${AIL_HOME}
|
|
|
|
|
|
|
|
if [ -e "${DIR}/AILENV/bin/python" ]; then
|
|
|
|
ENV_PY="${DIR}/AILENV/bin/python"
|
2019-05-01 14:31:47 +02:00
|
|
|
export AIL_VENV=${AIL_HOME}/AILENV/
|
2020-09-03 14:38:17 +02:00
|
|
|
. ./AILENV/bin/activate
|
2018-11-22 06:57:24 +01:00
|
|
|
else
|
2024-02-05 09:57:53 +01:00
|
|
|
echo "Please make sure AILENV is installed"
|
2018-11-22 06:57:24 +01:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2018-11-22 08:16:31 +01:00
|
|
|
export PATH=$AIL_VENV/bin:$PATH
|
2014-08-22 14:52:02 +02:00
|
|
|
export PATH=$AIL_HOME:$PATH
|
|
|
|
export PATH=$AIL_REDIS:$PATH
|
2023-06-29 09:07:00 +02:00
|
|
|
export PATH=$AIL_KVROCKS:$PATH
|
2018-07-24 10:41:10 +02:00
|
|
|
export PATH=$AIL_BIN:$PATH
|
|
|
|
export PATH=$AIL_FLASK:$PATH
|
2014-08-06 11:43:40 +02:00
|
|
|
|
2024-02-05 09:57:53 +01:00
|
|
|
function check_screens {
|
|
|
|
isredis=`screen -ls | egrep '[0-9]+.Redis_AIL' | cut -d. -f1`
|
|
|
|
isardb=`screen -ls | egrep '[0-9]+.ARDB_AIL' | cut -d. -f1`
|
|
|
|
iskvrocks=`screen -ls | egrep '[0-9]+.KVROCKS_AIL' | cut -d. -f1`
|
|
|
|
islogged=`screen -ls | egrep '[0-9]+.Logging_AIL' | cut -d. -f1`
|
|
|
|
is_ail_core=`screen -ls | egrep '[0-9]+.Core_AIL' | cut -d. -f1`
|
|
|
|
is_ail_2_ail=`screen -ls | egrep '[0-9]+.AIL_2_AIL' | cut -d. -f1`
|
|
|
|
isscripted=`screen -ls | egrep '[0-9]+.Script_AIL' | cut -d. -f1`
|
|
|
|
isflasked=`screen -ls | egrep '[0-9]+.Flask_AIL' | cut -d. -f1`
|
|
|
|
isfeeded=`screen -ls | egrep '[0-9]+.Feeder_Pystemon' | cut -d. -f1`
|
|
|
|
}
|
2014-08-06 11:43:40 +02:00
|
|
|
|
|
|
|
function helptext {
|
|
|
|
echo -e $YELLOW"
|
|
|
|
|
|
|
|
.o. ooooo ooooo
|
|
|
|
.888. \`888' \`888'
|
|
|
|
.8\"888. 888 888
|
|
|
|
.8' \`888. 888 888
|
|
|
|
.88ooo8888. 888 888
|
|
|
|
.8' \`888. 888 888 o
|
|
|
|
o88o o8888o o o888o o o888ooooood8
|
|
|
|
|
|
|
|
Analysis Information Leak framework
|
|
|
|
"$DEFAULT"
|
|
|
|
This script launch:
|
|
|
|
"$CYAN"
|
2019-07-26 14:28:02 +02:00
|
|
|
- All the queuing modules.
|
|
|
|
- All the processing modules.
|
2014-08-06 11:43:40 +02:00
|
|
|
- All Redis in memory servers.
|
2022-06-24 16:45:35 +02:00
|
|
|
- All KVROCKS servers.
|
2014-08-06 11:43:40 +02:00
|
|
|
"$DEFAULT"
|
|
|
|
(Inside screen Daemons)
|
|
|
|
"$DEFAULT"
|
|
|
|
Usage:
|
|
|
|
-----
|
2018-07-24 10:41:10 +02:00
|
|
|
LAUNCH.sh
|
2019-09-12 13:25:29 +02:00
|
|
|
[-l | --launchAuto] LAUNCH DB + Scripts
|
|
|
|
[-k | --killAll] Kill DB + Scripts
|
2024-02-02 11:42:10 +01:00
|
|
|
[-r | --restart] Restart
|
2019-09-12 13:25:29 +02:00
|
|
|
[-ks | --killscript] Scripts
|
|
|
|
[-u | --update] Update AIL
|
2021-06-02 14:42:23 +02:00
|
|
|
[-ut | --thirdpartyUpdate] Update UI/Frontend
|
2021-05-17 18:03:30 +02:00
|
|
|
[-t | --test] Launch Tests
|
2020-05-19 10:07:27 +02:00
|
|
|
[-rp | --resetPassword] Reset Password
|
2021-05-17 18:03:30 +02:00
|
|
|
[-f | --launchFeeder] LAUNCH Pystemon feeder
|
2019-09-12 13:25:29 +02:00
|
|
|
[-m | --menu] Display Advanced Menu
|
|
|
|
[-h | --help] Help
|
2014-08-06 11:43:40 +02:00
|
|
|
"
|
|
|
|
}
|
|
|
|
|
|
|
|
function launching_redis {
|
2014-08-22 14:52:02 +02:00
|
|
|
conf_dir="${AIL_HOME}/configs/"
|
2014-08-06 11:43:40 +02:00
|
|
|
|
2017-09-26 16:17:06 +02:00
|
|
|
screen -dmS "Redis_AIL"
|
2014-08-06 11:43:40 +02:00
|
|
|
sleep 0.1
|
|
|
|
echo -e $GREEN"\t* Launching Redis servers"$DEFAULT
|
2017-09-26 16:17:06 +02:00
|
|
|
screen -S "Redis_AIL" -X screen -t "6379" bash -c 'redis-server '$conf_dir'6379.conf ; read x'
|
2014-08-06 11:43:40 +02:00
|
|
|
sleep 0.1
|
2017-09-26 16:17:06 +02:00
|
|
|
screen -S "Redis_AIL" -X screen -t "6380" bash -c 'redis-server '$conf_dir'6380.conf ; read x'
|
2014-08-06 11:43:40 +02:00
|
|
|
sleep 0.1
|
2017-09-26 16:17:06 +02:00
|
|
|
screen -S "Redis_AIL" -X screen -t "6381" bash -c 'redis-server '$conf_dir'6381.conf ; read x'
|
2014-08-06 11:43:40 +02:00
|
|
|
}
|
|
|
|
|
2018-05-07 14:50:40 +02:00
|
|
|
function launching_ardb {
|
|
|
|
conf_dir="${AIL_HOME}/configs/"
|
2017-08-23 10:16:56 +02:00
|
|
|
|
2018-05-07 14:50:40 +02:00
|
|
|
screen -dmS "ARDB_AIL"
|
2014-08-06 11:43:40 +02:00
|
|
|
sleep 0.1
|
2018-05-07 14:50:40 +02:00
|
|
|
echo -e $GREEN"\t* Launching ARDB servers"$DEFAULT
|
2016-08-09 11:59:36 +02:00
|
|
|
|
2018-05-07 14:50:40 +02:00
|
|
|
sleep 0.1
|
2018-07-24 10:41:10 +02:00
|
|
|
screen -S "ARDB_AIL" -X screen -t "6382" bash -c 'cd '${AIL_HOME}'; ardb-server '$conf_dir'6382.conf ; read x'
|
2014-08-06 11:43:40 +02:00
|
|
|
}
|
|
|
|
|
2022-06-24 16:45:35 +02:00
|
|
|
function launching_kvrocks {
|
|
|
|
conf_dir="${AIL_HOME}/configs"
|
|
|
|
|
|
|
|
screen -dmS "KVROCKS_AIL"
|
|
|
|
sleep 0.1
|
|
|
|
echo -e $GREEN"\t* Launching KVROCKS servers"$DEFAULT
|
|
|
|
|
|
|
|
sleep 0.1
|
|
|
|
screen -S "KVROCKS_AIL" -X screen -t "6383" bash -c 'cd '${AIL_HOME}'; ./kvrocks/build/kvrocks -c '$conf_dir'/6383.conf ; read x'
|
|
|
|
}
|
|
|
|
|
2014-08-06 11:43:40 +02:00
|
|
|
function launching_logs {
|
2022-09-02 14:26:18 +02:00
|
|
|
conf_dir="${AIL_HOME}/configs/"
|
|
|
|
syslog_cmd=""
|
|
|
|
syslog_enabled=`cat $conf_dir/core.cfg | grep 'ail_logs_syslog' | cut -d " " -f 3 `
|
|
|
|
if [ "$syslog_enabled" = "True" ]; then
|
|
|
|
syslog_cmd="--syslog"
|
|
|
|
fi
|
|
|
|
syslog_server=`cat $conf_dir/core.cfg | grep 'ail_logs_syslog_server' | cut -d " " -f 3 `
|
|
|
|
syslog_port=`cat $conf_dir/core.cfg | grep 'ail_logs_syslog_port' | cut -d " " -f 3 `
|
|
|
|
if [ ! -z "$syslog_server" -a "$str" != " " ]; then
|
|
|
|
syslog_cmd="${syslog_cmd} -ss ${syslog_server}"
|
|
|
|
if [ ! -z "$syslog_port" -a "$str" != " " ]; then
|
|
|
|
syslog_cmd="${syslog_cmd} -sp ${syslog_port}"
|
|
|
|
fi
|
|
|
|
fi
|
2022-09-08 13:40:02 +02:00
|
|
|
syslog_facility=`cat $conf_dir/core.cfg | grep 'ail_logs_syslog_facility' | cut -d " " -f 3 `
|
|
|
|
if [ ! -z "$syslog_facility" -a "$str" != " " ]; then
|
|
|
|
syslog_cmd="${syslog_cmd} -sf ${syslog_facility}"
|
|
|
|
fi
|
|
|
|
syslog_level=`cat $conf_dir/core.cfg | grep 'ail_logs_syslog_level' | cut -d " " -f 3 `
|
|
|
|
if [ ! -z "$syslog_level" -a "$str" != " " ]; then
|
|
|
|
syslog_cmd="${syslog_cmd} -sl ${syslog_level}"
|
|
|
|
fi
|
2022-09-02 14:26:18 +02:00
|
|
|
|
2017-09-26 16:17:06 +02:00
|
|
|
screen -dmS "Logging_AIL"
|
2014-08-06 11:43:40 +02:00
|
|
|
sleep 0.1
|
|
|
|
echo -e $GREEN"\t* Launching logging process"$DEFAULT
|
2022-09-02 14:26:18 +02:00
|
|
|
screen -S "Logging_AIL" -X screen -t "LogScript" bash -c "cd ${AIL_BIN}; ${AIL_VENV}/bin/log_subscriber -p 6380 -c Script -l ../logs/ ${syslog_cmd}; read x"
|
2014-08-06 11:43:40 +02:00
|
|
|
}
|
|
|
|
|
2018-07-24 10:41:10 +02:00
|
|
|
function checking_configuration {
|
|
|
|
bin_dir=${AIL_HOME}/bin
|
2017-04-25 09:32:05 +02:00
|
|
|
echo -e "\t* Checking configuration"
|
2019-04-23 15:04:45 +02:00
|
|
|
bash -c "${ENV_PY} $bin_dir/Update-conf.py"
|
2017-04-25 09:32:05 +02:00
|
|
|
exitStatus=$?
|
|
|
|
if [ $exitStatus -ge 1 ]; then
|
|
|
|
echo -e $RED"\t* Configuration not up-to-date"$DEFAULT
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
echo -e $GREEN"\t* Configuration up-to-date"$DEFAULT
|
2018-07-24 10:41:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function launching_scripts {
|
2019-04-23 15:04:45 +02:00
|
|
|
checking_configuration;
|
2017-04-25 09:32:05 +02:00
|
|
|
|
2017-09-26 16:17:06 +02:00
|
|
|
screen -dmS "Script_AIL"
|
2014-08-06 11:43:40 +02:00
|
|
|
sleep 0.1
|
|
|
|
|
2021-06-02 16:04:52 +02:00
|
|
|
##################################
|
|
|
|
# CORE MODULES #
|
|
|
|
##################################
|
2021-10-29 18:48:12 +02:00
|
|
|
# screen -dmS "Core_AIL"
|
|
|
|
# sleep 0.1
|
|
|
|
echo -e $GREEN"\t* Launching core scripts ..."$DEFAULT
|
|
|
|
|
2023-04-13 14:25:02 +02:00
|
|
|
# Clear Queue Stats
|
|
|
|
pushd ${AIL_BIN}
|
|
|
|
${ENV_PY} ./AIL_Init.py
|
|
|
|
popd
|
2021-10-29 18:48:12 +02:00
|
|
|
|
2023-04-13 14:25:02 +02:00
|
|
|
# TODO: IMPORTER SCREEN ????
|
2021-10-29 18:48:12 +02:00
|
|
|
#### SYNC ####
|
|
|
|
screen -S "Script_AIL" -X screen -t "ail_2_ail_server" bash -c "cd ${AIL_BIN}/core; ${ENV_PY} ./ail_2_ail_server.py; read x"
|
|
|
|
sleep 0.1
|
2023-04-13 14:25:02 +02:00
|
|
|
screen -S "Script_AIL" -X screen -t "Sync_importer" bash -c "cd ${AIL_BIN}/core; ${ENV_PY} ./Sync_importer.py; read x"
|
|
|
|
sleep 0.1
|
2021-10-29 18:48:12 +02:00
|
|
|
screen -S "Script_AIL" -X screen -t "Sync_manager" bash -c "cd ${AIL_BIN}/core; ${ENV_PY} ./Sync_manager.py; read x"
|
|
|
|
sleep 0.1
|
|
|
|
##-- SYNC --##
|
|
|
|
|
2023-02-03 16:13:57 +01:00
|
|
|
screen -S "Script_AIL" -X screen -t "ZMQImporter" bash -c "cd ${AIL_BIN}/importer; ${ENV_PY} ./ZMQImporter.py; read x"
|
|
|
|
sleep 0.1
|
|
|
|
screen -S "Script_AIL" -X screen -t "FeederImporter" bash -c "cd ${AIL_BIN}/importer; ${ENV_PY} ./FeederImporter.py; read x"
|
2020-04-28 14:14:45 +02:00
|
|
|
sleep 0.1
|
2021-03-31 11:25:09 +02:00
|
|
|
screen -S "Script_AIL" -X screen -t "D4_client" bash -c "cd ${AIL_BIN}/core; ${ENV_PY} ./D4_client.py; read x"
|
|
|
|
sleep 0.1
|
2020-04-28 14:14:45 +02:00
|
|
|
|
2021-06-07 16:14:18 +02:00
|
|
|
screen -S "Script_AIL" -X screen -t "UpdateBackground" bash -c "cd ${AIL_BIN}; ${ENV_PY} ./update-background.py; read x"
|
|
|
|
sleep 0.1
|
|
|
|
|
2021-06-02 16:04:52 +02:00
|
|
|
##################################
|
|
|
|
# MODULES #
|
|
|
|
##################################
|
2021-10-29 18:48:12 +02:00
|
|
|
# screen -dmS "Script_AIL"
|
|
|
|
# sleep 0.1
|
|
|
|
echo -e $GREEN"\t* Launching scripts"$DEFAULT
|
|
|
|
|
2023-04-04 10:25:01 +02:00
|
|
|
screen -S "Script_AIL" -X screen -t "Mixer" bash -c "cd ${AIL_BIN}/modules; ${ENV_PY} ./Mixer.py; read x"
|
|
|
|
sleep 0.1
|
2021-06-02 16:04:52 +02:00
|
|
|
screen -S "Script_AIL" -X screen -t "Global" bash -c "cd ${AIL_BIN}/modules; ${ENV_PY} ./Global.py; read x"
|
2018-04-11 10:48:22 +02:00
|
|
|
sleep 0.1
|
2021-06-02 16:04:52 +02:00
|
|
|
screen -S "Script_AIL" -X screen -t "Categ" bash -c "cd ${AIL_BIN}/modules; ${ENV_PY} ./Categ.py; read x"
|
2018-04-11 10:48:22 +02:00
|
|
|
sleep 0.1
|
2021-06-02 16:04:52 +02:00
|
|
|
screen -S "Script_AIL" -X screen -t "Tags" bash -c "cd ${AIL_BIN}/modules; ${ENV_PY} ./Tags.py; read x"
|
2018-04-12 17:06:57 +02:00
|
|
|
sleep 0.1
|
2023-04-13 14:25:02 +02:00
|
|
|
screen -S "Script_AIL" -X screen -t "SubmitPaste" bash -c "cd ${AIL_BIN}/modules; ${ENV_PY} ./SubmitPaste.py; read x"
|
2018-04-12 17:06:57 +02:00
|
|
|
sleep 0.1
|
2021-06-02 16:04:52 +02:00
|
|
|
|
2022-10-25 16:25:19 +02:00
|
|
|
screen -S "Script_AIL" -X screen -t "Crawler" bash -c "cd ${AIL_BIN}/crawlers; ${ENV_PY} ./Crawler.py; read x"
|
|
|
|
sleep 0.1
|
|
|
|
|
2021-10-29 18:48:12 +02:00
|
|
|
screen -S "Script_AIL" -X screen -t "Sync_module" bash -c "cd ${AIL_BIN}/core; ${ENV_PY} ./Sync_module.py; read x"
|
|
|
|
sleep 0.1
|
|
|
|
|
2021-06-02 16:04:52 +02:00
|
|
|
screen -S "Script_AIL" -X screen -t "ApiKey" bash -c "cd ${AIL_BIN}/modules; ${ENV_PY} ./ApiKey.py; read x"
|
2018-04-16 14:50:04 +02:00
|
|
|
sleep 0.1
|
2021-06-02 16:04:52 +02:00
|
|
|
screen -S "Script_AIL" -X screen -t "Credential" bash -c "cd ${AIL_BIN}/modules; ${ENV_PY} ./Credential.py; read x"
|
2018-04-12 17:06:57 +02:00
|
|
|
sleep 0.1
|
2021-06-02 16:04:52 +02:00
|
|
|
screen -S "Script_AIL" -X screen -t "CreditCards" bash -c "cd ${AIL_BIN}/modules; ${ENV_PY} ./CreditCards.py; read x"
|
2018-07-26 15:31:58 +02:00
|
|
|
sleep 0.1
|
2022-11-28 15:01:40 +01:00
|
|
|
screen -S "Script_AIL" -X screen -t "Cryptocurrency" bash -c "cd ${AIL_BIN}/modules; ${ENV_PY} ./Cryptocurrencies.py; read x"
|
|
|
|
sleep 0.1
|
2023-02-22 11:08:29 +01:00
|
|
|
screen -S "Script_AIL" -X screen -t "CveModule" bash -c "cd ${AIL_BIN}/modules; ${ENV_PY} ./CveModule.py; read x"
|
2022-09-20 16:11:48 +02:00
|
|
|
sleep 0.1
|
2021-06-02 16:04:52 +02:00
|
|
|
screen -S "Script_AIL" -X screen -t "Decoder" bash -c "cd ${AIL_BIN}/modules; ${ENV_PY} ./Decoder.py; read x"
|
2018-04-12 17:06:57 +02:00
|
|
|
sleep 0.1
|
2022-09-20 16:11:48 +02:00
|
|
|
screen -S "Script_AIL" -X screen -t "Duplicates" bash -c "cd ${AIL_BIN}/modules; ${ENV_PY} ./Duplicates.py; read x"
|
|
|
|
sleep 0.1
|
|
|
|
screen -S "Script_AIL" -X screen -t "Iban" bash -c "cd ${AIL_BIN}/modules; ${ENV_PY} ./Iban.py; read x"
|
|
|
|
sleep 0.1
|
2023-05-15 11:39:16 +02:00
|
|
|
screen -S "Script_AIL" -X screen -t "IPAddress" bash -c "cd ${AIL_BIN}/modules; ${ENV_PY} ./IPAddress.py; read x"
|
|
|
|
sleep 0.1
|
2021-06-02 16:04:52 +02:00
|
|
|
screen -S "Script_AIL" -X screen -t "Keys" bash -c "cd ${AIL_BIN}/modules; ${ENV_PY} ./Keys.py; read x"
|
2018-04-12 17:06:57 +02:00
|
|
|
sleep 0.1
|
2022-09-20 16:11:48 +02:00
|
|
|
screen -S "Script_AIL" -X screen -t "Languages" bash -c "cd ${AIL_BIN}/modules; ${ENV_PY} ./Languages.py; read x"
|
2018-04-20 10:48:44 +02:00
|
|
|
sleep 0.1
|
2022-09-08 10:31:57 +02:00
|
|
|
screen -S "Script_AIL" -X screen -t "Mail" bash -c "cd ${AIL_BIN}/modules; ${ENV_PY} ./Mail.py; read x"
|
|
|
|
sleep 0.1
|
2022-09-20 16:11:48 +02:00
|
|
|
screen -S "Script_AIL" -X screen -t "Onion" bash -c "cd ${AIL_BIN}/modules; ${ENV_PY} ./Onion.py; read x"
|
|
|
|
sleep 0.1
|
2022-11-29 16:01:01 +01:00
|
|
|
screen -S "Script_AIL" -X screen -t "PgpDump" bash -c "cd ${AIL_BIN}/modules; ${ENV_PY} ./PgpDump.py; read x"
|
|
|
|
sleep 0.1
|
2023-05-24 10:48:29 +02:00
|
|
|
screen -S "Script_AIL" -X screen -t "Phone" bash -c "cd ${AIL_BIN}/modules; ${ENV_PY} ./Phone.py; read x"
|
|
|
|
sleep 0.1
|
2022-03-08 08:50:01 +01:00
|
|
|
screen -S "Script_AIL" -X screen -t "Telegram" bash -c "cd ${AIL_BIN}/modules; ${ENV_PY} ./Telegram.py; read x"
|
2022-01-19 16:25:17 +01:00
|
|
|
sleep 0.1
|
2023-01-18 16:28:08 +01:00
|
|
|
screen -S "Script_AIL" -X screen -t "Tools" bash -c "cd ${AIL_BIN}/modules; ${ENV_PY} ./Tools.py; read x"
|
|
|
|
sleep 0.1
|
2021-06-07 16:14:18 +02:00
|
|
|
|
2022-05-30 09:15:50 +02:00
|
|
|
screen -S "Script_AIL" -X screen -t "Hosts" bash -c "cd ${AIL_BIN}/modules; ${ENV_PY} ./Hosts.py; read x"
|
|
|
|
sleep 0.1
|
|
|
|
screen -S "Script_AIL" -X screen -t "DomClassifier" bash -c "cd ${AIL_BIN}/modules; ${ENV_PY} ./DomClassifier.py; read x"
|
|
|
|
sleep 0.1
|
|
|
|
|
2021-06-07 16:14:18 +02:00
|
|
|
screen -S "Script_AIL" -X screen -t "Urls" bash -c "cd ${AIL_BIN}/modules; ${ENV_PY} ./Urls.py; read x"
|
|
|
|
sleep 0.1
|
|
|
|
screen -S "Script_AIL" -X screen -t "SQLInjectionDetection" bash -c "cd ${AIL_BIN}/modules; ${ENV_PY} ./SQLInjectionDetection.py; read x"
|
|
|
|
sleep 0.1
|
2023-12-12 10:30:40 +01:00
|
|
|
# screen -S "Script_AIL" -X screen -t "LibInjection" bash -c "cd ${AIL_BIN}/modules; ${ENV_PY} ./LibInjection.py; read x"
|
|
|
|
# sleep 0.1
|
2023-10-12 13:53:00 +02:00
|
|
|
# screen -S "Script_AIL" -X screen -t "Pasties" bash -c "cd ${AIL_BIN}/modules; ${ENV_PY} ./Pasties.py; read x"
|
2024-09-16 10:09:56 +02:00
|
|
|
# sleep 0.1
|
|
|
|
# screen -S "Script_AIL" -X screen -t "Indexer" bash -c "cd ${AIL_BIN}/modules; ${ENV_PY} ./Indexer.py; read x"
|
2023-10-12 13:53:00 +02:00
|
|
|
# sleep 0.1
|
2021-06-02 16:04:52 +02:00
|
|
|
|
2023-05-16 16:34:22 +02:00
|
|
|
screen -S "Script_AIL" -X screen -t "MISP_Thehive_Auto_Push" bash -c "cd ${AIL_BIN}/modules; ${ENV_PY} ./MISP_Thehive_Auto_Push.py; read x"
|
|
|
|
sleep 0.1
|
|
|
|
|
2024-04-24 14:43:11 +02:00
|
|
|
# IMAGES
|
2023-11-15 15:45:25 +01:00
|
|
|
screen -S "Script_AIL" -X screen -t "Exif" bash -c "cd ${AIL_BIN}/modules; ${ENV_PY} ./Exif.py; read x"
|
|
|
|
sleep 0.1
|
2024-04-24 14:43:11 +02:00
|
|
|
screen -S "Script_AIL" -X screen -t "OcrExtractor" bash -c "cd ${AIL_BIN}/modules; ${ENV_PY} ./OcrExtractor.py; read x"
|
|
|
|
sleep 0.1
|
2024-11-05 14:10:30 +01:00
|
|
|
screen -S "Script_AIL" -X screen -t "CodeReader" bash -c "cd ${AIL_BIN}/modules; ${ENV_PY} ./CodeReader.py; read x"
|
2024-10-01 15:12:15 +02:00
|
|
|
sleep 0.1
|
2023-11-15 15:45:25 +01:00
|
|
|
|
2024-10-16 11:02:18 +02:00
|
|
|
# TITLES
|
|
|
|
screen -S "Script_AIL" -X screen -t "CEDetector" bash -c "cd ${AIL_BIN}/modules; ${ENV_PY} ./CEDetector.py; read x"
|
|
|
|
sleep 0.1
|
|
|
|
|
2021-06-02 16:04:52 +02:00
|
|
|
##################################
|
|
|
|
# TRACKERS MODULES #
|
|
|
|
##################################
|
|
|
|
screen -S "Script_AIL" -X screen -t "Tracker_Term" bash -c "cd ${AIL_BIN}/trackers; ${ENV_PY} ./Tracker_Term.py; read x"
|
2018-04-16 14:50:04 +02:00
|
|
|
sleep 0.1
|
2023-03-16 16:49:53 +01:00
|
|
|
screen -S "Script_AIL" -X screen -t "Tracker_Typo_Squatting" bash -c "cd ${AIL_BIN}/trackers; ${ENV_PY} ./Tracker_Typo_Squatting.py; read x"
|
|
|
|
sleep 0.1
|
2021-06-02 16:53:17 +02:00
|
|
|
screen -S "Script_AIL" -X screen -t "Tracker_Regex" bash -c "cd ${AIL_BIN}/trackers; ${ENV_PY} ./Tracker_Regex.py; read x"
|
|
|
|
sleep 0.1
|
2021-06-02 16:04:52 +02:00
|
|
|
screen -S "Script_AIL" -X screen -t "Tracker_Yara" bash -c "cd ${AIL_BIN}/trackers; ${ENV_PY} ./Tracker_Yara.py; read x"
|
2018-04-12 17:06:57 +02:00
|
|
|
sleep 0.1
|
2021-07-14 13:58:00 +02:00
|
|
|
screen -S "Script_AIL" -X screen -t "Retro_Hunt" bash -c "cd ${AIL_BIN}/trackers; ${ENV_PY} ./Retro_Hunt.py; read x"
|
|
|
|
sleep 0.1
|
|
|
|
screen -S "Script_AIL" -X screen -t "Retro_Hunt" bash -c "cd ${AIL_BIN}/trackers; ${ENV_PY} ./Retro_Hunt.py; read x"
|
|
|
|
sleep 0.1
|
2021-06-02 16:04:52 +02:00
|
|
|
|
|
|
|
##################################
|
|
|
|
# DISABLED MODULES #
|
|
|
|
##################################
|
2022-10-25 16:25:19 +02:00
|
|
|
# screen -S "Script_AIL" -X screen -t "SentimentAnalysis" bash -c "cd ${AIL_BIN}/modules; ${ENV_PY} ./SentimentAnalysis.py; read x"
|
|
|
|
# sleep 0.1
|
|
|
|
# screen -S "Script_AIL" -X screen -t "Release" bash -c "cd ${AIL_BIN}; ${ENV_PY} ./Release.py; read x"
|
|
|
|
# sleep 0.1
|
2023-03-30 15:23:41 +02:00
|
|
|
# screen -S "Script_AIL" -X screen -t "ModuleStats" bash -c "cd ${AIL_BIN}/modules; ${ENV_PY} ./ModuleStats.py; read x"
|
|
|
|
# sleep 0.1
|
2021-06-02 16:04:52 +02:00
|
|
|
|
|
|
|
##################################
|
2023-02-03 16:13:57 +01:00
|
|
|
# TO MIGRATE #
|
2021-06-02 16:04:52 +02:00
|
|
|
##################################
|
2023-05-16 16:34:22 +02:00
|
|
|
# screen -S "Script_AIL" -X screen -t "ModuleInformation" bash -c "cd ${AIL_BIN}; ${ENV_PY} ./ModulesInformationV2.py -k 0 -c 1; read x"
|
2023-04-04 10:25:01 +02:00
|
|
|
# sleep 0.1
|
2016-08-19 13:34:02 +02:00
|
|
|
|
2014-08-06 11:43:40 +02:00
|
|
|
|
2021-06-02 16:04:52 +02:00
|
|
|
}
|
2018-09-24 16:23:14 +02:00
|
|
|
|
2022-06-24 16:45:35 +02:00
|
|
|
function shutting_down_redis_servers {
|
|
|
|
array=("$@")
|
|
|
|
redis_dir=${AIL_HOME}/redis/src
|
|
|
|
for port in "${array[@]}";
|
|
|
|
do
|
2022-08-19 16:53:31 +02:00
|
|
|
bash -c "${redis_dir}/redis-cli -p ${port} -a ail SHUTDOWN"
|
2022-06-24 16:45:35 +02:00
|
|
|
sleep 0.1
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
2017-09-26 16:17:06 +02:00
|
|
|
function shutting_down_redis {
|
2022-06-24 16:45:35 +02:00
|
|
|
ports=("6379" "6380" "6381")
|
|
|
|
shutting_down_redis_servers "${ports[@]}"
|
2018-05-07 14:50:40 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function shutting_down_ardb {
|
2022-06-24 16:45:35 +02:00
|
|
|
ports=("6382")
|
|
|
|
shutting_down_redis_servers "${ports[@]}"
|
2017-09-26 16:17:06 +02:00
|
|
|
}
|
|
|
|
|
2022-06-24 16:45:35 +02:00
|
|
|
function shutting_down_kvrocks {
|
|
|
|
ports=("6383")
|
|
|
|
shutting_down_redis_servers "${ports[@]}"
|
|
|
|
}
|
2018-05-07 14:50:40 +02:00
|
|
|
|
2022-06-24 16:45:35 +02:00
|
|
|
function checking_redis_servers {
|
|
|
|
db_name=$1
|
|
|
|
shift
|
|
|
|
array=("$@")
|
|
|
|
redis_dir="${AIL_HOME}/redis/src"
|
|
|
|
flag_db=0
|
|
|
|
for port in "${array[@]}";
|
|
|
|
do
|
|
|
|
sleep 0.2
|
2022-08-19 16:53:31 +02:00
|
|
|
bash -c "${redis_dir}/redis-cli -p ${port} -a ail PING | grep "PONG" &> /dev/null"
|
2022-06-24 16:45:35 +02:00
|
|
|
if [ ! $? == 0 ]; then
|
|
|
|
echo -e "${RED}\t${port} ${db_name} not ready${DEFAULT}"
|
|
|
|
flag_db=1
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
return $flag_db;
|
|
|
|
}
|
|
|
|
|
|
|
|
function checking_redis {
|
|
|
|
ports=("6379" "6380" "6381")
|
|
|
|
checking_redis_servers "Redis" "${ports[@]}"
|
|
|
|
return $?
|
2018-05-07 14:50:40 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function checking_ardb {
|
2022-06-24 16:45:35 +02:00
|
|
|
ports=("6382")
|
|
|
|
checking_redis_servers "ARDB" "${ports[@]}"
|
|
|
|
return $?
|
|
|
|
}
|
2018-05-07 14:50:40 +02:00
|
|
|
|
2022-06-24 16:45:35 +02:00
|
|
|
function checking_kvrocks {
|
|
|
|
ports=("6383")
|
|
|
|
checking_redis_servers "KVROCKS" "${ports[@]}"
|
|
|
|
return $?
|
2017-09-26 16:17:06 +02:00
|
|
|
}
|
|
|
|
|
2019-04-12 15:06:24 +02:00
|
|
|
function wait_until_redis_is_ready {
|
|
|
|
redis_not_ready=true
|
|
|
|
while $redis_not_ready; do
|
|
|
|
if checking_redis; then
|
|
|
|
redis_not_ready=false;
|
|
|
|
else
|
|
|
|
sleep 1
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
echo -e $YELLOW"\t* Redis Launched"$DEFAULT
|
|
|
|
}
|
|
|
|
|
|
|
|
function wait_until_ardb_is_ready {
|
|
|
|
ardb_not_ready=true;
|
|
|
|
while $ardb_not_ready; do
|
|
|
|
if checking_ardb; then
|
|
|
|
ardb_not_ready=false
|
|
|
|
else
|
|
|
|
sleep 3
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
echo -e $YELLOW"\t* ARDB Launched"$DEFAULT
|
|
|
|
}
|
|
|
|
|
2022-06-24 16:45:35 +02:00
|
|
|
function wait_until_kvrocks_is_ready {
|
|
|
|
not_ready=true;
|
|
|
|
while $not_ready; do
|
|
|
|
if checking_kvrocks; then
|
|
|
|
not_ready=false
|
|
|
|
else
|
|
|
|
sleep 3
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
echo -e $YELLOW"\t* KVROCKS Launched"$DEFAULT
|
|
|
|
}
|
|
|
|
|
2018-07-24 10:41:10 +02:00
|
|
|
function launch_redis {
|
|
|
|
if [[ ! $isredis ]]; then
|
|
|
|
launching_redis;
|
|
|
|
else
|
|
|
|
echo -e $RED"\t* A screen is already launched"$DEFAULT
|
|
|
|
fi
|
|
|
|
}
|
2014-08-06 11:43:40 +02:00
|
|
|
|
2018-07-24 10:41:10 +02:00
|
|
|
function launch_ardb {
|
|
|
|
if [[ ! $isardb ]]; then
|
|
|
|
launching_ardb;
|
|
|
|
else
|
|
|
|
echo -e $RED"\t* A screen is already launched"$DEFAULT
|
|
|
|
fi
|
|
|
|
}
|
2014-08-06 11:43:40 +02:00
|
|
|
|
2022-06-24 16:45:35 +02:00
|
|
|
function launch_kvrocks {
|
|
|
|
if [[ ! $iskvrocks ]]; then
|
|
|
|
launching_kvrocks;
|
|
|
|
else
|
|
|
|
echo -e $RED"\t* A screen is already launched"$DEFAULT
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2018-07-24 10:41:10 +02:00
|
|
|
function launch_logs {
|
|
|
|
if [[ ! $islogged ]]; then
|
|
|
|
launching_logs;
|
|
|
|
else
|
|
|
|
echo -e $RED"\t* A screen is already launched"$DEFAULT
|
|
|
|
fi
|
|
|
|
}
|
2014-08-06 11:43:40 +02:00
|
|
|
|
2018-07-24 10:41:10 +02:00
|
|
|
function launch_scripts {
|
2021-10-29 18:48:12 +02:00
|
|
|
if [[ ! $isscripted ]]; then ############################# is core
|
2018-07-24 10:41:10 +02:00
|
|
|
sleep 1
|
2023-04-04 13:53:16 +02:00
|
|
|
if checking_redis && checking_kvrocks; then
|
2019-04-23 15:04:45 +02:00
|
|
|
launching_scripts;
|
2018-07-24 10:41:10 +02:00
|
|
|
else
|
2018-07-24 12:18:41 +02:00
|
|
|
no_script_launched=true
|
|
|
|
while $no_script_launched; do
|
|
|
|
echo -e $YELLOW"\tScript not started, waiting 5 more secondes"$DEFAULT
|
2018-07-24 10:41:10 +02:00
|
|
|
sleep 5
|
2023-04-04 13:53:16 +02:00
|
|
|
if checking_redis && checking_kvrocks; then
|
2019-04-23 15:04:45 +02:00
|
|
|
launching_scripts;
|
2018-07-24 12:18:41 +02:00
|
|
|
no_script_launched=false
|
2018-07-24 10:41:10 +02:00
|
|
|
else
|
|
|
|
echo -e $RED"\tScript not started"$DEFAULT
|
|
|
|
fi;
|
|
|
|
done
|
|
|
|
fi;
|
|
|
|
else
|
|
|
|
echo -e $RED"\t* A screen is already launched"$DEFAULT
|
|
|
|
fi
|
2014-08-06 11:43:40 +02:00
|
|
|
}
|
|
|
|
|
2018-07-24 10:41:10 +02:00
|
|
|
function launch_flask {
|
|
|
|
if [[ ! $isflasked ]]; then
|
|
|
|
flask_dir=${AIL_FLASK}
|
|
|
|
screen -dmS "Flask_AIL"
|
|
|
|
sleep 0.1
|
|
|
|
echo -e $GREEN"\t* Launching Flask server"$DEFAULT
|
2018-11-22 06:57:24 +01:00
|
|
|
screen -S "Flask_AIL" -X screen -t "Flask_server" bash -c "cd $flask_dir; ls; ${ENV_PY} ./Flask_server.py; read x"
|
2018-07-24 10:41:10 +02:00
|
|
|
else
|
|
|
|
echo -e $RED"\t* A Flask screen is already launched"$DEFAULT
|
|
|
|
fi
|
|
|
|
}
|
2014-08-06 11:43:40 +02:00
|
|
|
|
2018-09-03 16:01:39 +02:00
|
|
|
function launch_feeder {
|
|
|
|
if [[ ! $isfeeded ]]; then
|
2018-09-19 09:52:27 +02:00
|
|
|
screen -dmS "Feeder_Pystemon"
|
2018-09-03 16:01:39 +02:00
|
|
|
sleep 0.1
|
|
|
|
echo -e $GREEN"\t* Launching Pystemon feeder"$DEFAULT
|
2023-04-14 14:43:07 +02:00
|
|
|
screen -S "Feeder_Pystemon" -X screen -t "Pystemon_feeder" bash -c "cd ${AIL_BIN}; ${ENV_PY} ./importer/PystemonImporter.py; read x"
|
2018-09-03 16:01:39 +02:00
|
|
|
sleep 0.1
|
2018-11-22 07:41:45 +01:00
|
|
|
screen -S "Feeder_Pystemon" -X screen -t "Pystemon" bash -c "cd ${AIL_HOME}/../pystemon; ${ENV_PY} ./pystemon.py; read x"
|
2018-09-03 16:01:39 +02:00
|
|
|
else
|
|
|
|
echo -e $RED"\t* A Feeder screen is already launched"$DEFAULT
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2019-09-12 13:25:29 +02:00
|
|
|
function killscript {
|
2023-04-13 14:25:02 +02:00
|
|
|
if [[ $islogged || $is_ail_core || $isscripted || $isflasked || $isfeeded || $is_ail_2_ail ]]; then
|
2019-09-12 13:25:29 +02:00
|
|
|
echo -e $GREEN"Killing Script"$DEFAULT
|
2023-04-13 14:25:02 +02:00
|
|
|
kill $islogged $is_ail_core $isscripted $isflasked $isfeeded $is_ail_2_ail
|
2019-09-12 13:25:29 +02:00
|
|
|
sleep 0.2
|
|
|
|
echo -e $ROSE`screen -ls`$DEFAULT
|
2023-04-13 14:25:02 +02:00
|
|
|
echo -e $GREEN"\t* $islogged $is_ail_core $isscripted $isflasked $isfeeded $is_ail_2_ail killed."$DEFAULT
|
2019-09-12 13:25:29 +02:00
|
|
|
else
|
|
|
|
echo -e $RED"\t* No script to kill"$DEFAULT
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2018-07-24 10:41:10 +02:00
|
|
|
function killall {
|
2023-04-13 14:25:02 +02:00
|
|
|
if [[ $isredis || $isardb || $iskvrocks || $islogged || $is_ail_2_ail || $isscripted || $isflasked || $isfeeded || $is_ail_core || $is_ail_2_ail ]]; then
|
2018-12-19 11:41:01 +01:00
|
|
|
if [[ $isredis ]]; then
|
|
|
|
echo -e $GREEN"Gracefully closing redis servers"$DEFAULT
|
|
|
|
shutting_down_redis;
|
|
|
|
sleep 0.2
|
|
|
|
fi
|
|
|
|
if [[ $isardb ]]; then
|
|
|
|
echo -e $GREEN"Gracefully closing ardb servers"$DEFAULT
|
|
|
|
shutting_down_ardb;
|
|
|
|
fi
|
2022-06-24 16:45:35 +02:00
|
|
|
if [[ $iskvrocks ]]; then
|
|
|
|
echo -e $GREEN"Gracefully closing Kvrocks servers"$DEFAULT
|
|
|
|
shutting_down_kvrocks;
|
|
|
|
fi
|
2018-07-24 10:41:10 +02:00
|
|
|
echo -e $GREEN"Killing all"$DEFAULT
|
2023-04-13 14:25:02 +02:00
|
|
|
kill $isredis $isardb $iskvrocks $islogged $is_ail_core $isscripted $isflasked $isfeeded $is_ail_2_ail
|
2018-07-24 10:41:10 +02:00
|
|
|
sleep 0.2
|
|
|
|
echo -e $ROSE`screen -ls`$DEFAULT
|
2023-04-13 14:25:02 +02:00
|
|
|
echo -e $GREEN"\t* $isredis $isardb $iskvrocks $islogged $isscripted $is_ail_2_ail $isflasked $isfeeded $is_ail_core killed."$DEFAULT
|
2018-07-24 10:41:10 +02:00
|
|
|
else
|
|
|
|
echo -e $RED"\t* No screen to kill"$DEFAULT
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2022-08-19 16:53:31 +02:00
|
|
|
function _set_kvrocks_namespace() {
|
|
|
|
bash -c "${redis_dir}/redis-cli -p ${port} -a ail namespace add $1 $2"
|
|
|
|
}
|
|
|
|
|
|
|
|
function set_kvrocks_namespaces() {
|
|
|
|
if checking_kvrocks; then
|
|
|
|
_set_kvrocks_namespace "cor" "ail_correls"
|
|
|
|
_set_kvrocks_namespace "obj" "ail_objs"
|
|
|
|
_set_kvrocks_namespace "tag" "ail_tags"
|
|
|
|
else
|
|
|
|
echo -e $RED"\t* Error: Please launch Kvrocks server"$DEFAULT
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2018-11-13 15:45:22 +01:00
|
|
|
function update() {
|
2018-11-13 16:54:39 +01:00
|
|
|
bin_dir=${AIL_HOME}/bin
|
2018-11-13 15:45:22 +01:00
|
|
|
|
2019-12-10 16:12:05 +01:00
|
|
|
bash -c "python3 $bin_dir/Update.py $1"
|
2018-11-13 15:45:22 +01:00
|
|
|
exitStatus=$?
|
2020-02-26 10:19:36 +01:00
|
|
|
if [ $exitStatus -ge 3 ]; then
|
|
|
|
echo -e "\t* Update..."
|
|
|
|
bash -c "python3 $bin_dir/Update.py $1"
|
|
|
|
exitStatus=$?
|
|
|
|
if [ $exitStatus -ge 1 ]; then
|
|
|
|
echo -e $RED"\t* Update Error"$DEFAULT
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2018-11-13 15:45:22 +01:00
|
|
|
if [ $exitStatus -ge 1 ]; then
|
|
|
|
echo -e $RED"\t* Update Error"$DEFAULT
|
|
|
|
exit
|
|
|
|
fi
|
2020-05-12 16:46:11 +02:00
|
|
|
|
2018-11-13 15:45:22 +01:00
|
|
|
}
|
|
|
|
|
2018-07-24 10:41:10 +02:00
|
|
|
function update_thirdparty {
|
|
|
|
echo -e "\t* Updating thirdparty..."
|
|
|
|
bash -c "(cd ${AIL_FLASK}; ./update_thirdparty.sh)"
|
|
|
|
exitStatus=$?
|
|
|
|
if [ $exitStatus -ge 1 ]; then
|
|
|
|
echo -e $RED"\t* Thirdparty not up-to-date"$DEFAULT
|
|
|
|
exit
|
|
|
|
else
|
|
|
|
echo -e $GREEN"\t* Thirdparty updated"$DEFAULT
|
2014-08-06 11:43:40 +02:00
|
|
|
fi
|
2018-07-24 10:41:10 +02:00
|
|
|
}
|
|
|
|
|
2021-05-17 18:03:30 +02:00
|
|
|
function launch_tests() {
|
|
|
|
tests_dir=${AIL_HOME}/tests
|
|
|
|
bin_dir=${AIL_BIN}
|
2024-08-13 14:23:50 +02:00
|
|
|
echo -e ""
|
|
|
|
echo -e $GREEN"AIL SCREENS:"$DEFAULT
|
|
|
|
echo -e $ROSE`screen -ls`$DEFAULT
|
|
|
|
echo -e $GREEN"\t* Redis: $isredis"$DEFAULT
|
|
|
|
echo -e $GREEN"\t* Kvrocks: $iskvrocks $isscripted $isflasked"$DEFAULT
|
|
|
|
echo -e $GREEN"\t* Modules: $isscripted"$DEFAULT
|
|
|
|
echo -e $GREEN"\t* Flask: $isflasked"$DEFAULT
|
|
|
|
echo -e ""
|
|
|
|
echo -e ""
|
2024-02-27 11:03:11 +01:00
|
|
|
python3 -m nose2 --start-dir $tests_dir --coverage $bin_dir --with-coverage test_api test_modules
|
2021-05-17 18:03:30 +02:00
|
|
|
}
|
|
|
|
|
2020-05-19 10:07:27 +02:00
|
|
|
function reset_password() {
|
2023-05-23 13:38:33 +02:00
|
|
|
echo -e "\t* Resetting UI admin password..."
|
2023-04-04 13:53:16 +02:00
|
|
|
if checking_kvrocks && checking_redis; then
|
2020-05-19 10:07:27 +02:00
|
|
|
python ${AIL_HOME}/var/www/create_default_user.py &
|
|
|
|
wait
|
|
|
|
else
|
|
|
|
echo -e $RED"\t* Error: Please launch all Redis and ARDB servers"$DEFAULT
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2018-07-24 10:41:10 +02:00
|
|
|
function launch_all {
|
2019-04-25 17:17:12 +02:00
|
|
|
checking_configuration;
|
2018-11-13 15:45:22 +01:00
|
|
|
update;
|
2018-07-24 10:41:10 +02:00
|
|
|
launch_redis;
|
2022-06-24 16:45:35 +02:00
|
|
|
launch_kvrocks;
|
2019-04-23 15:04:45 +02:00
|
|
|
launch_scripts;
|
2018-07-24 10:41:10 +02:00
|
|
|
launch_flask;
|
|
|
|
}
|
2014-08-06 11:43:40 +02:00
|
|
|
|
2019-09-12 13:25:29 +02:00
|
|
|
function menu_display {
|
|
|
|
|
2024-12-09 13:54:54 +01:00
|
|
|
options=("Redis" "Kvrocks" "Scripts" "Flask" "Killall" "Update" "Update-config" "Update-thirdparty")
|
2019-09-12 13:25:29 +02:00
|
|
|
|
|
|
|
menu() {
|
|
|
|
echo "What do you want to Launch?:"
|
|
|
|
for i in ${!options[@]}; do
|
|
|
|
printf "%3d%s) %s\n" $((i+1)) "${choices[i]:- }" "${options[i]}"
|
|
|
|
done
|
|
|
|
[[ "$msg" ]] && echo "$msg"; :
|
|
|
|
}
|
|
|
|
|
|
|
|
prompt="Check an option (again to uncheck, ENTER when done): "
|
|
|
|
|
|
|
|
while menu && read -rp "$prompt" numinput && [[ "$numinput" ]]; do
|
|
|
|
for num in $numinput; do
|
|
|
|
[[ "$num" != *[![:digit:]]* ]] && (( num > 0 && num <= ${#options[@]} )) || {
|
|
|
|
msg="Invalid option: $num"; break
|
|
|
|
}
|
|
|
|
((num--)); msg="${options[num]} was ${choices[num]:+un}checked"
|
|
|
|
[[ "${choices[num]}" ]] && choices[num]="" || choices[num]="+"
|
|
|
|
done
|
|
|
|
done
|
|
|
|
|
|
|
|
for i in ${!options[@]}; do
|
|
|
|
if [[ "${choices[i]}" ]]; then
|
|
|
|
case ${options[i]} in
|
|
|
|
Redis)
|
|
|
|
launch_redis;
|
|
|
|
;;
|
2022-06-24 16:45:35 +02:00
|
|
|
Kvrocks)
|
|
|
|
launch_kvrocks;
|
|
|
|
;;
|
2019-09-12 13:25:29 +02:00
|
|
|
Scripts)
|
|
|
|
launch_scripts;
|
|
|
|
;;
|
|
|
|
Flask)
|
|
|
|
launch_flask;
|
|
|
|
;;
|
|
|
|
Killall)
|
|
|
|
killall;
|
|
|
|
;;
|
|
|
|
Update)
|
2022-03-07 15:54:56 +01:00
|
|
|
checking_configuration;
|
2019-09-12 13:25:29 +02:00
|
|
|
update;
|
|
|
|
;;
|
|
|
|
Update-config)
|
|
|
|
checking_configuration;
|
|
|
|
;;
|
|
|
|
Update-thirdparty)
|
|
|
|
update_thirdparty;
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
exit
|
2014-08-06 11:43:40 +02:00
|
|
|
|
2019-09-12 13:25:29 +02:00
|
|
|
}
|
2018-07-24 10:41:10 +02:00
|
|
|
|
2014-08-06 11:43:40 +02:00
|
|
|
|
2019-09-12 13:25:29 +02:00
|
|
|
#If no params, display the help
|
|
|
|
[[ $@ ]] || {
|
2014-08-06 11:43:40 +02:00
|
|
|
|
2019-09-12 13:25:29 +02:00
|
|
|
helptext;
|
2018-07-24 10:41:10 +02:00
|
|
|
}
|
|
|
|
|
2019-04-11 17:49:20 +02:00
|
|
|
#echo "$@"
|
2024-02-05 09:57:53 +01:00
|
|
|
check_screens;
|
2018-07-24 10:41:10 +02:00
|
|
|
while [ "$1" != "" ]; do
|
|
|
|
case $1 in
|
2024-02-05 11:32:49 +01:00
|
|
|
-l | --launchAuto ) check_screens;
|
|
|
|
launch_all "automatic";
|
2022-06-24 16:45:35 +02:00
|
|
|
;;
|
2024-02-05 11:32:49 +01:00
|
|
|
-lr | --launchRedis ) check_screens;
|
|
|
|
launch_redis;
|
2022-06-24 16:45:35 +02:00
|
|
|
;;
|
|
|
|
-la | --launchARDB ) launch_ardb;
|
|
|
|
;;
|
2024-02-05 11:32:49 +01:00
|
|
|
-lk | --launchKVROCKS ) check_screens;
|
|
|
|
launch_kvrocks;
|
2022-06-24 16:45:35 +02:00
|
|
|
;;
|
|
|
|
-lrv | --launchRedisVerify ) launch_redis;
|
|
|
|
wait_until_redis_is_ready;
|
|
|
|
;;
|
|
|
|
-lkv | --launchKVORCKSVerify ) launch_kvrocks;
|
|
|
|
wait_until_kvrocks_is_ready;
|
|
|
|
;;
|
2022-08-19 16:53:31 +02:00
|
|
|
--set_kvrocks_namespaces ) set_kvrocks_namespaces;
|
|
|
|
;;
|
2024-02-05 11:09:41 +01:00
|
|
|
-k | --killAll ) check_screens;
|
|
|
|
killall;
|
2022-06-24 16:45:35 +02:00
|
|
|
;;
|
2024-02-02 11:42:10 +01:00
|
|
|
-r | --restart ) killall;
|
|
|
|
sleep 0.1;
|
2024-02-05 09:57:53 +01:00
|
|
|
check_screens;
|
2024-01-18 11:42:37 +01:00
|
|
|
launch_all "automatic";
|
|
|
|
;;
|
2024-02-05 11:32:49 +01:00
|
|
|
-ks | --killscript ) check_screens;
|
|
|
|
killscript;
|
2022-06-24 16:45:35 +02:00
|
|
|
;;
|
|
|
|
-m | --menu ) menu_display;
|
|
|
|
;;
|
|
|
|
-u | --update ) checking_configuration;
|
|
|
|
update "--manual";
|
|
|
|
;;
|
|
|
|
-t | --test ) launch_tests;
|
|
|
|
;;
|
|
|
|
-ut | --thirdpartyUpdate ) update_thirdparty;
|
|
|
|
;;
|
|
|
|
-rp | --resetPassword ) reset_password;
|
|
|
|
;;
|
|
|
|
-f | --launchFeeder ) launch_feeder;
|
|
|
|
;;
|
|
|
|
-h | --help ) helptext;
|
|
|
|
exit
|
|
|
|
;;
|
|
|
|
-kh | --khelp ) helptext;
|
|
|
|
;;
|
|
|
|
* ) helptext
|
|
|
|
exit 1
|
2018-07-24 10:41:10 +02:00
|
|
|
esac
|
|
|
|
shift
|
2014-08-06 11:43:40 +02:00
|
|
|
done
|