mirror of
https://github.com/ail-project/ail-framework.git
synced 2024-11-26 07:47:17 +00:00
fix: [reset_AIL] add helper + fix soft reset
This commit is contained in:
parent
9bee423eaf
commit
2ad7d912b3
1 changed files with 47 additions and 24 deletions
71
reset_AIL.sh
71
reset_AIL.sh
|
@ -6,6 +6,29 @@ GREEN="\\033[1;32m"
|
||||||
|
|
||||||
[ -z "$AIL_HOME" ] && echo "Needs the env var AIL_HOME. Run the script from the virtual environment." && exit 1;
|
[ -z "$AIL_HOME" ] && echo "Needs the env var AIL_HOME. Run the script from the virtual environment." && exit 1;
|
||||||
|
|
||||||
|
function helptext {
|
||||||
|
echo -e $GREEN"
|
||||||
|
|
||||||
|
.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"
|
||||||
|
Use this script to reset AIL (DB + stored items):
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
-----
|
||||||
|
reset_AIL.sh
|
||||||
|
[--softReset] Keep All users accounts
|
||||||
|
[-h | --help] Help
|
||||||
|
"
|
||||||
|
}
|
||||||
|
|
||||||
function reset_dir {
|
function reset_dir {
|
||||||
# Access dirs and delete
|
# Access dirs and delete
|
||||||
cd $AIL_HOME
|
cd $AIL_HOME
|
||||||
|
@ -23,16 +46,6 @@ function reset_dir {
|
||||||
popd
|
popd
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $userInput -eq $num ]
|
|
||||||
then
|
|
||||||
if [ -d DATA_ARDB/ ]; then
|
|
||||||
pushd DATA_ARDB/
|
|
||||||
rm -r *
|
|
||||||
echo 'cleaned DATA_ARDB'
|
|
||||||
popd
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -d logs/ ]; then
|
if [ -d logs/ ]; then
|
||||||
pushd logs/
|
pushd logs/
|
||||||
rm *
|
rm *
|
||||||
|
@ -97,29 +110,36 @@ function flush_DB_keep_user {
|
||||||
bash ${AIL_BIN}LAUNCH.sh -k
|
bash ${AIL_BIN}LAUNCH.sh -k
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function validate_reset {
|
||||||
|
echo -e $RED"WARNING: DELETE AIL DATA"$DEFAULT
|
||||||
|
|
||||||
|
# Make sure the reseting is intentional
|
||||||
|
num=$(( ( RANDOM % 100 ) + 1 ))
|
||||||
|
|
||||||
|
echo -e $RED"To reset the platform, enter the following number: "$DEFAULT $num
|
||||||
|
read userInput
|
||||||
|
|
||||||
|
if [ $userInput -eq $num ]
|
||||||
|
then
|
||||||
|
echo "Reseting AIL..."
|
||||||
|
else
|
||||||
|
echo "Wrong number"
|
||||||
|
exit 1;
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
function soft_reset {
|
function soft_reset {
|
||||||
|
validate_reset;
|
||||||
reset_dir;
|
reset_dir;
|
||||||
flush_DB_keep_user;
|
flush_DB_keep_user;
|
||||||
}
|
}
|
||||||
|
|
||||||
#If no params,
|
#If no params,
|
||||||
[[ $@ ]] || {
|
[[ $@ ]] || {
|
||||||
# Make sure the reseting is intentional
|
validate_reset;
|
||||||
num=$(( ( RANDOM % 100 ) + 1 ))
|
|
||||||
|
|
||||||
echo -e $RED"To reset the platform, enter the following number: "$DEFAULT $num
|
|
||||||
read userInput
|
|
||||||
|
|
||||||
if [ $userInput -eq $num ]
|
|
||||||
then
|
|
||||||
echo "Reseting AIL..."
|
|
||||||
else
|
|
||||||
echo "Wrong number"
|
|
||||||
exit 1;
|
|
||||||
fi
|
|
||||||
|
|
||||||
num=$(( ( RANDOM % 100 ) + 1 ))
|
num=$(( ( RANDOM % 100 ) + 1 ))
|
||||||
echo -e $RED"If yes you want to delete the DB , enter the following number: "$DEFAULT $num
|
echo -e $RED"If you want to delete the DB , enter the following number: "$DEFAULT $num
|
||||||
read userInput
|
read userInput
|
||||||
|
|
||||||
reset_dir;
|
reset_dir;
|
||||||
|
@ -143,6 +163,9 @@ while [ "$1" != "" ]; do
|
||||||
case $1 in
|
case $1 in
|
||||||
--softReset ) soft_reset;
|
--softReset ) soft_reset;
|
||||||
;;
|
;;
|
||||||
|
-h | --help ) helptext;
|
||||||
|
exit
|
||||||
|
;;
|
||||||
* ) exit 1
|
* ) exit 1
|
||||||
esac
|
esac
|
||||||
shift
|
shift
|
||||||
|
|
Loading…
Reference in a new issue