58 lines
1.1 KiB
Bash
Executable File
58 lines
1.1 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Vérifie qu'on est bien en root
|
|
if [ $(id -u) -ne 0 ]
|
|
then
|
|
echo "Ce script doit être executé en root" >&2
|
|
exit 1
|
|
fi
|
|
|
|
. /etc/suidchecker.conf &>/dev/null || . suidchecker.conf &>/dev/null
|
|
|
|
export DATABASE
|
|
export INSTALL_PATH
|
|
|
|
OPTS=$(getopt -o h -l init,reinit,add,check,help -- "$@")
|
|
eval set -- $OPTS
|
|
|
|
set -e
|
|
|
|
usage() {
|
|
echo "Utilisation du script :"
|
|
echo -e "\t--init : initialise la base de données"
|
|
echo -e "\t--reinit : réinitialise la base de données"
|
|
echo -e "\t--add : parcours l'arborescence et ajoute les fichiers ayant le bit SUID qui n'existent pas dans la base"
|
|
echo -e "\t--check : vérifie les fichiers répertoriés dans la base"
|
|
echo -e "\t--help, -h : affiche ce message"
|
|
}
|
|
|
|
init() {
|
|
$INSTALL_PATH/init.sh
|
|
}
|
|
|
|
reinit() {
|
|
rm $DATABASE
|
|
init
|
|
}
|
|
|
|
add() {
|
|
$INSTALL_PATH/add.sh
|
|
}
|
|
|
|
check() {
|
|
$INSTALL_PATH/check.sh
|
|
}
|
|
|
|
while true ; do
|
|
case "$1" in
|
|
-h|--help) usage; exit 0;;
|
|
--init) init; shift;;
|
|
--reinit) reinit; shift;;
|
|
--add) add; shift;;
|
|
--check) check; shift;;
|
|
--) shift; break;;
|
|
esac
|
|
done
|
|
|
|
exit 0
|