2017-08-22 17:16:06 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
RED="\\033[1;31m"
|
|
|
|
DEFAULT="\\033[0;39m"
|
|
|
|
GREEN="\\033[1;32m"
|
|
|
|
|
|
|
|
[ -z "$AIL_HOME" ] && echo "Needs the env var AIL_HOME. Run the script from the virtual environment." && exit 1;
|
|
|
|
|
2020-06-24 14:27:10 +02:00
|
|
|
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
|
|
|
|
"
|
|
|
|
}
|
|
|
|
|
2019-07-30 16:10:08 +02:00
|
|
|
function reset_dir {
|
2019-07-30 15:21:27 +02:00
|
|
|
# Access dirs and delete
|
|
|
|
cd $AIL_HOME
|
2017-08-22 17:16:06 +02:00
|
|
|
|
2019-07-30 15:21:27 +02:00
|
|
|
# Kill all screens
|
|
|
|
screen -ls | grep Detached | cut -d. -f1 | awk '{print $1}' | xargs kill
|
2017-08-22 17:16:06 +02:00
|
|
|
|
2019-07-30 15:21:27 +02:00
|
|
|
# Access dirs and delete
|
|
|
|
cd $AIL_HOME
|
2017-08-22 17:16:06 +02:00
|
|
|
|
2019-07-30 15:21:27 +02:00
|
|
|
if [ -d indexdir/ ]; then
|
|
|
|
pushd indexdir/
|
|
|
|
rm -r *
|
|
|
|
echo 'cleaned indexdir'
|
|
|
|
popd
|
|
|
|
fi
|
2017-08-22 17:16:06 +02:00
|
|
|
|
2019-07-30 15:21:27 +02:00
|
|
|
if [ -d logs/ ]; then
|
|
|
|
pushd logs/
|
|
|
|
rm *
|
|
|
|
echo 'cleaned logs'
|
|
|
|
popd
|
|
|
|
fi
|
2017-08-22 17:16:06 +02:00
|
|
|
|
2019-07-30 15:21:27 +02:00
|
|
|
if [ -d PASTES/ ]; then
|
|
|
|
pushd PASTES/
|
|
|
|
rm -r *
|
|
|
|
echo 'cleaned PASTES'
|
|
|
|
popd
|
|
|
|
fi
|
2017-08-22 17:16:06 +02:00
|
|
|
|
2019-07-30 15:21:27 +02:00
|
|
|
if [ -d HASHS/ ]; then
|
|
|
|
pushd HASHS/
|
|
|
|
rm -r *
|
|
|
|
echo 'cleaned HASHS'
|
|
|
|
popd
|
|
|
|
fi
|
2017-08-22 17:16:06 +02:00
|
|
|
|
2019-07-30 15:21:27 +02:00
|
|
|
if [ -d CRAWLED_SCREESHOT/ ]; then
|
|
|
|
pushd CRAWLED_SCREESHOT/
|
|
|
|
rm -r *
|
|
|
|
echo 'cleaned CRAWLED_SCREESHOT'
|
|
|
|
popd
|
|
|
|
fi
|
2017-08-22 17:16:06 +02:00
|
|
|
|
2019-07-30 15:21:27 +02:00
|
|
|
if [ -d temp/ ]; then
|
|
|
|
pushd temp/
|
|
|
|
rm -r *
|
|
|
|
echo 'cleaned temp'
|
|
|
|
popd
|
|
|
|
fi
|
2017-08-22 17:16:06 +02:00
|
|
|
|
2019-07-30 15:21:27 +02:00
|
|
|
if [ -d var/www/submitted/ ]; then
|
|
|
|
pushd var/www/submitted
|
|
|
|
rm -r *
|
|
|
|
echo 'cleaned submitted'
|
|
|
|
popd
|
|
|
|
fi
|
2017-08-22 17:16:06 +02:00
|
|
|
|
2019-07-30 15:21:27 +02:00
|
|
|
echo -e $GREEN"* AIL has been reset *"$DEFAULT
|
|
|
|
}
|
|
|
|
|
2019-07-30 15:58:11 +02:00
|
|
|
function flush_DB_keep_user {
|
2019-07-30 16:04:42 +02:00
|
|
|
bash ${AIL_BIN}LAUNCH.sh -lav &
|
|
|
|
wait
|
|
|
|
echo ""
|
2019-07-30 15:58:11 +02:00
|
|
|
pushd redis/src
|
|
|
|
./redis-cli -p 6382 -n 1 FLUSHDB;
|
|
|
|
./redis-cli -p 6382 -n 2 FLUSHDB;
|
|
|
|
./redis-cli -p 6382 -n 3 FLUSHDB;
|
|
|
|
./redis-cli -p 6382 -n 4 FLUSHDB;
|
|
|
|
./redis-cli -p 6382 -n 5 FLUSHDB;
|
|
|
|
./redis-cli -p 6382 -n 6 FLUSHDB;
|
|
|
|
./redis-cli -p 6382 -n 7 FLUSHDB;
|
|
|
|
./redis-cli -p 6382 -n 8 FLUSHDB;
|
|
|
|
./redis-cli -p 6382 -n 9 FLUSHDB;
|
2019-07-30 16:21:39 +02:00
|
|
|
echo "ARDB FLUSHED"
|
2019-07-30 15:58:11 +02:00
|
|
|
popd
|
2019-07-30 16:04:42 +02:00
|
|
|
bash ${AIL_BIN}LAUNCH.sh -k
|
2019-07-30 15:58:11 +02:00
|
|
|
}
|
|
|
|
|
2020-06-24 14:27:10 +02:00
|
|
|
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
|
|
|
|
}
|
|
|
|
|
2019-07-30 16:12:51 +02:00
|
|
|
function soft_reset {
|
2020-06-24 14:27:10 +02:00
|
|
|
validate_reset;
|
2019-07-30 16:10:08 +02:00
|
|
|
reset_dir;
|
|
|
|
flush_DB_keep_user;
|
|
|
|
}
|
|
|
|
|
2019-07-30 15:21:27 +02:00
|
|
|
#If no params,
|
|
|
|
[[ $@ ]] || {
|
2020-06-24 14:27:10 +02:00
|
|
|
validate_reset;
|
2019-07-30 15:21:27 +02:00
|
|
|
|
|
|
|
num=$(( ( RANDOM % 100 ) + 1 ))
|
2020-06-24 14:27:10 +02:00
|
|
|
echo -e $RED"If you want to delete the DB , enter the following number: "$DEFAULT $num
|
2019-07-30 15:21:27 +02:00
|
|
|
read userInput
|
|
|
|
|
2019-07-30 16:10:08 +02:00
|
|
|
reset_dir;
|
2019-07-30 15:21:27 +02:00
|
|
|
|
|
|
|
if [ $userInput -eq $num ]
|
|
|
|
then
|
|
|
|
if [ -d DATA_ARDB/ ]; then
|
|
|
|
pushd DATA_ARDB/
|
|
|
|
rm -r *
|
|
|
|
echo 'cleaned DATA_ARDB'
|
|
|
|
popd
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo -e $GREEN"* AIL has been reset *"$DEFAULT
|
|
|
|
|
|
|
|
exit
|
|
|
|
}
|
|
|
|
|
|
|
|
while [ "$1" != "" ]; do
|
|
|
|
case $1 in
|
2019-07-30 16:12:51 +02:00
|
|
|
--softReset ) soft_reset;
|
2019-07-30 15:58:11 +02:00
|
|
|
;;
|
2020-06-24 14:27:10 +02:00
|
|
|
-h | --help ) helptext;
|
|
|
|
exit
|
|
|
|
;;
|
2019-07-30 15:21:27 +02:00
|
|
|
* ) exit 1
|
|
|
|
esac
|
|
|
|
shift
|
|
|
|
done
|