LinuxSecu/secu

179 lines
2.5 KiB
Plaintext
Raw Permalink Normal View History

2022-08-24 07:57:22 +02:00
#!/bin/bash
#MENU Linux Secu (C) In4Matik 2021
clear
#pres requis:
#root
if [ "$EUID" -ne 0 ]
then echo "Please run as root"
exit
fi
while : ; do
choix=$(whiptail --title "<-- Linux Secu V 1.0 (C) GNU GPL In4Matik-->" --menu " >> Faite votre choix: " 23 69 16 \
1 " Run checkrootkit debsums" \
2 " Run check Rkhunter All" \
3 " Run check Rkhunter juste alerte importante" \
4 " Run Update Rkhunter" \
5 " Run Fix Rkhunter " \
10 " Run Update ClamAv " \
11 " Run Scan ClamAv " \
20 " Gestion service " \
23 " Fin " 3>&1 1>&2 2>&3)
exitstatus=$?
#on recupere ce choix
#exitstatus=$?
if [ $exitstatus = 0 ]; then
echo "Vous avez choisi l option:" $choix
else
echo "Votre choix Fin."; break;
fi
# case : action en fonction du choix
case $choix in
#checkrootkit debsums
1)
clear
checkrootkit
read -p "Press any key: "
;;
#Check rkhunter all
2)
clear
rkhunter --checkall
read -p "Press any key: "
;;
#Ceck rkhunter alerte importante
3)
clear
rkhunter -c --rwo
read -p "Press any key: "
;;
#update rkhunter
4)
clear
rkhunter --update
read -p "Press any key: "
;;
#Fix rkhunter
5)
clear
rkhunter --propupd
read -p "Press any key: "
;;
#Update Clamav
10)
clear
clamavupdate
read -p "Press any key: "
;;
#Scan clamav
11)
#choix du chemin
while true
do
path=$(whiptail --title "Choix du chemin" --inputbox " >> Saissir le chemin pour le scan: " 8 39 /home 3>&1 1>&2 2>&3)
if [ $? != 0 ]; then
break;
elif [ $path != "" ]; then
break;
fi
done
$(clamscan "$path")
read -p "Press any key: "
;;
# menu gestion service
20)
while : ; do
choix2=$(whiptail --title "<-- Linux Secu V 1.0 (C) GNU GPL In4Matik-->" --menu " >> Faite votre choix: " 23 69 16 \
1 " Restart fail2ban " \
2 " Check client fail2ban " \
3 " Restart clamav " \
10 " Status fail2ban " \
11 " Status clamav " \
23 " Retour " 3>&1 1>&2 2>&3)
exitstatus2=$?
#on recupere ce choix
#exitstatus=$?
if [ $exitstatus2 = 0 ]; then
echo "Vous avez choisi l option:" $choix2
else
echo "Votre choix Fin."; break;
fi
# case : action en fonction du choix
case $choix2 in
#service gestion
1)
service fail2ban restart
;;
#check fail2ban client
2)
fail2ban-client status
read -p "Press any key: "
;;
#service clamav
3)
clamav-freshclam restart
;;
#status fail2ban
10)
service fail2ban status
read -p "Press any key: "
;;
#status clamav
11)
clamav-freshclam status
read -p "Press any key: "
;;
#Retour menu principal
23)
break
;;
esac
done
;;
#Fin du menu principal
23)
exit 0
;;
esac
done
exit 0