You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
357 lines
14 KiB
357 lines
14 KiB
#!/bin/bash
|
|
|
|
clear
|
|
|
|
BGRED="\e[41m"
|
|
BGGREEN="\e[42m"
|
|
|
|
RED="\e[31m"
|
|
GREEN="\e[32m"
|
|
LIGHT_RED="\e[91m"
|
|
LIGHT_GREEN="\e[92m"
|
|
YELLOW="\e[33m"
|
|
CYAN="\e[36m"
|
|
ENDCOLOR="\e[0m"
|
|
|
|
Aff() {
|
|
printf "\n"
|
|
printf "\n ${CYAN}█████ ████ ████ ████████ ██████ ██████ ██ ███████"
|
|
printf "\n ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ "
|
|
printf "\n ██ ██ ████ ████ ██ ██ ██ ██ ██ ██ ███████ "
|
|
printf "\n ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ "
|
|
printf "\n █████ ████ ██ ██ ██████ ██████ ███████ ███████${ENDCOLOR}\n"
|
|
}
|
|
|
|
i=0
|
|
while ((i==0))
|
|
do
|
|
Aff
|
|
|
|
printf "\n▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬"
|
|
printf "\n "
|
|
printf "\n (1) • Panel"
|
|
printf "\n (2) • CMD Message Protection"
|
|
printf "\n (3) • SSH Protection"
|
|
printf "\n (4) • PSQL PassWord Protection"
|
|
printf "\n (5) • BASHRC Protection"
|
|
printf "\n (6) • Sound Protection"
|
|
printf "\n (7) • Panic Button"
|
|
printf "\n (8) • Information"
|
|
printf "\n (9) • Exit"
|
|
printf "\n "
|
|
printf "\n▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬${ENDCOLOR}\n"
|
|
|
|
read -p "Tools Number: " toolsuse
|
|
|
|
if [[ $toolsuse == "1" ]]; then
|
|
clear
|
|
printf "Chargemement en cours.."
|
|
cmdpanel_msg="$(ls -l -A /dev/pts | grep $USER | grep -v 'rw-------' | wc -l)"
|
|
cmdpanel_file="$(ls -ld ~ | grep -o '^\S*')"
|
|
cmdpanel_ssh="$(ls -ld ~/.ssh | grep -o '^\S*')"
|
|
cmdpanel_psqlaccess="$(ls -l ~/.psql_history | grep -o '^\S*' | cut -c 5-)"
|
|
cmdpanel_psqlpwd="$(cat ~/.psql_history | grep 'WITH PASSWORD' | wc -l)"
|
|
cmdpanel_bashrc="$(ls -ld ~/.bashrc | grep -o '^\S*')"
|
|
clear
|
|
Aff
|
|
printf "\n▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬"
|
|
printf "\n\t\t\tType:\n"
|
|
printf "\n ${GREEN}•${ENDCOLOR} Protégé / Activé \n ${YELLOW}•${ENDCOLOR} Vulnérable / Warning \n ${RED}•${ENDCOLOR} Hautement Vulnérable / Désactivé\n"
|
|
printf "____________________________________________________\n"
|
|
if [[ $cmdpanel_msg == "0" ]]; then
|
|
printf "\n ${GREEN}• ${ENDCOLOR}CMD Message Protection"
|
|
else
|
|
printf "\n ${RED}• ${ENDCOLOR}CMD Message Protection"
|
|
fi
|
|
|
|
if [[ $cmdpanel_file == "drwx------" ]]; then
|
|
printf "\n ${GREEN}• ${ENDCOLOR}HOME File Protection"
|
|
else
|
|
if [[ $cmdpanel_file == "drwxrwxrwx" ]]; then
|
|
printf "\n ${RED}• ${ENDCOLOR}HOME File Protection"
|
|
else
|
|
printf "\n ${YELLOW}• ${ENDCOLOR}HOME File Protection"
|
|
fi
|
|
fi
|
|
|
|
if [[ $cmdpanel_ssh == "drwx------" ]]; then
|
|
printf "\n ${GREEN}• ${ENDCOLOR}SSH File Protection"
|
|
else
|
|
printf "\n ${RED}• ${ENDCOLOR}SSH File Protection"
|
|
fi
|
|
|
|
if [[ $cmdpanel_psqlpwd == "0" ]]; then
|
|
if [[ $cmdpanel_psqlaccess == "------" ]]; then
|
|
printf "\n ${GREEN}• ${ENDCOLOR}PSQL PASSWORD Protection"
|
|
else
|
|
printf "\n ${YELLOW}• ${ENDCOLOR}PSQL PASSWORD Protection"
|
|
fi
|
|
else
|
|
if [[ $cmdpanel_psqlaccess == "------" ]]; then
|
|
printf "\n ${RED}• ${ENDCOLOR}PSQL PASSWORD Protection"
|
|
else
|
|
printf "\n ${YELLOW}• ${ENDCOLOR}PSQL PASSWORD Protection"
|
|
fi
|
|
fi
|
|
|
|
if [[ $cmdpanel_bashrc == "-rw-------" || $cmdpanel_bashrc == "-rwx------" ]]; then
|
|
printf "\n ${GREEN}• ${ENDCOLOR}BASHRC Protection"
|
|
else
|
|
printf "\n ${RED}• ${ENDCOLOR}BASHRC Protection"
|
|
fi
|
|
|
|
if [[ $USER == "aufleury" || $USER == "logermain" || $USER == "lucastigli" || $USER == "khbruneau" || $USER == "dadalmeida1" ]]; then
|
|
printf "\n ${RED}• ${ENDCOLOR} Leak Found\n"
|
|
printf "\n ${YELLOW}WARNING SSH KEY / PSQL ARE LEAK\n"
|
|
else
|
|
printf "\n ${GREEN}• ${ENDCOLOR}No Leak Found"
|
|
fi
|
|
|
|
printf "\n "
|
|
printf "\n▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬\n"
|
|
read -p "Entrer pour continuer." enter
|
|
|
|
|
|
|
|
clear
|
|
elif [[ $toolsuse == "2" ]]; then
|
|
j=0
|
|
while ((j==0))
|
|
do
|
|
clear
|
|
cmdpanel_msg="$(ls -l -A /dev/pts | grep $USER | grep -v 'rw-------' | wc -l)"
|
|
|
|
Aff
|
|
|
|
printf "\n▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬"
|
|
printf "\n "
|
|
printf "\n\t\tMessage Protection"
|
|
printf "\n "
|
|
if [[ $cmdpanel_msg == "0" ]]; then
|
|
printf "\n\t\t ${ENDCOLOR} ${LIGHT_GREEN}Enable${ENDCOLOR}/${RED}Disable ${ENDCOLOR}\n"
|
|
else
|
|
printf "\n\t\t ${ENDCOLOR} ${GREEN}Enable${ENDCOLOR}/${LIGHT_RED}Disable ${ENDCOLOR}\n"
|
|
fi
|
|
printf "\n (1) • Enable"
|
|
printf "\n (2) • Disable"
|
|
printf "\n (3) • Exit"
|
|
printf "\n "
|
|
printf "\n▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬\n\n"
|
|
|
|
read -p ">> " cmdmed
|
|
if [[ $cmdmed == "1" ]]; then
|
|
chmod 600 /dev/pts/*
|
|
elif [[ $cmdmed == "2" ]]; then
|
|
chmod 666 /dev/pts/*
|
|
elif [[ $cmdmed == "3" ]]; then
|
|
j=1
|
|
else
|
|
printf "\n ${RED} ERR0R Invalide Input"
|
|
fi
|
|
done
|
|
clear
|
|
elif [[ $toolsuse == "3" ]]; then
|
|
j=0
|
|
while ((j==0))
|
|
do
|
|
clear
|
|
cmdpanel_ssh="$(ls -ld ~/.ssh | grep -o '^\S*')"
|
|
|
|
Aff
|
|
|
|
printf "\n▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬"
|
|
printf "\n "
|
|
printf "\n\t\tSSH File Protection"
|
|
printf "\n "
|
|
if [[ $cmdpanel_ssh == "drwx------" ]]; then
|
|
printf "\n\t\t ${ENDCOLOR} ${LIGHT_GREEN}Enable${ENDCOLOR}/${RED}Disable ${ENDCOLOR}\n"
|
|
else
|
|
printf "\n\t\t ${ENDCOLOR} ${GREEN}Enable${ENDCOLOR}/${LIGHT_RED}Disable ${ENDCOLOR}\n"
|
|
fi
|
|
printf "\n (1) • Enable"
|
|
printf "\n (2) • Disable"
|
|
printf "\n (3) • Exit"
|
|
printf "\n "
|
|
printf "\n▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬\n\n"
|
|
|
|
read -p ">> " sshproct
|
|
if [[ $sshproct == "1" ]]; then
|
|
chmod 700 ~/.ssh
|
|
elif [[ $sshproct == "2" ]]; then
|
|
read -p "Entrer la permission que vous voulez mettre: " perm
|
|
chmod $perm ~/.ssh
|
|
printf "Custom Perm au .ssh appliquée."
|
|
sleep 1
|
|
elif [[ $sshproct == "3" ]]; then
|
|
j=1
|
|
else
|
|
printf "\n ${RED} ERR0R Invalide Input${ENDCOLOR}"
|
|
fi
|
|
done
|
|
clear
|
|
elif [[ $toolsuse == "4" ]]; then
|
|
clear
|
|
printf "\n ${YELLOW}/!\\ WARNING /!\\ "
|
|
printf "\n"
|
|
printf "\nEn executant cette fonctionnalité, celle-ci supprimera"
|
|
printf "\nl'historique PSQL. ${ENDCOLOR}"
|
|
printf "\n"
|
|
read -p "Êtes vous sur d'executer cette fonctionnalité ? (Y/n) : " rmpsql
|
|
if [[ $rmpsql == "Y" ]]; then
|
|
printf "Veuillez confirmer en tapant le code si dessous."
|
|
rdmcode="$(echo $RANDOM)"
|
|
printf "\n"
|
|
echo $rdmcode
|
|
printf "\n"
|
|
read -p "Code: " code
|
|
if [[ $rdmcode == $code ]]; then
|
|
rm ~/.psql_history
|
|
sleep 2
|
|
clear
|
|
else
|
|
printf "\n>> ${RED}Code Invalide. ${ENDCOLOR}"
|
|
sleep 2
|
|
clear
|
|
fi
|
|
else
|
|
printf "\n>> Retour au Menu en cours.."
|
|
sleep 1
|
|
clear
|
|
fi
|
|
clear
|
|
elif [[ $toolsuse == "5" ]]; then
|
|
j=0
|
|
while ((j==0))
|
|
do
|
|
clear
|
|
cmdpanel_bashrc="$(ls -ld ~/.bashrc | grep -o '^\S*')"
|
|
|
|
Aff
|
|
|
|
printf "\n▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬"
|
|
printf "\n "
|
|
printf "\n\t\tBashrc Protection"
|
|
printf "\n "
|
|
if [[ $cmdpanel_bashrc == "-rwx------" || $cmdpanel_bashrc == "-rw-------" ]]; then
|
|
printf "\n\t\t ${ENDCOLOR} ${LIGHT_GREEN}Enable${ENDCOLOR}/${RED}Disable ${ENDCOLOR}\n"
|
|
else
|
|
printf "\n\t\t ${ENDCOLOR} ${GREEN}Enable${ENDCOLOR}/${LIGHT_RED}Disable ${ENDCOLOR}\n"
|
|
fi
|
|
printf "\n (1) • Enable"
|
|
printf "\n (2) • Disable"
|
|
printf "\n (3) • Exit"
|
|
printf "\n "
|
|
printf "\n▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬\n\n"
|
|
|
|
read -p ">> " bashrcproct
|
|
if [[ $bashrcproct == "1" ]]; then
|
|
chmod 600 ~/.bashrc
|
|
printf "Protection du .bashrc ${GREEN}activé${ENDCOLOR}"
|
|
sleep 1
|
|
elif [[ $bashrcproct == "2" ]]; then
|
|
read -p "Entrer la permission que vous voulez mettre: " perm
|
|
chmod $perm ~/.bashrc
|
|
printf "Custom Perm au .bashrc appliquée."
|
|
sleep 1
|
|
elif [[ $bashrcproct == "3" ]]; then
|
|
j=1
|
|
else
|
|
printf "\n ${RED} ERR0R Invalide Input${ENDCOLOR}"
|
|
fi
|
|
done
|
|
clear
|
|
elif [[ $toolsuse == "6" ]]; then
|
|
printf "${RED} NoSound in Dev.."
|
|
sleep 1
|
|
clear
|
|
#read -p "Êtes vous sur d'activer le NoSound ? (y/n) : " nosound
|
|
#if [[ $nosound == "y" ]]; then
|
|
# nosound_patch="while true; do pactl set-sink-mute 0 true; pactl set-sink-volume 0 0%; done"
|
|
# exe="${nosound_patch} &"
|
|
# $exe
|
|
# printf "\n ${GREEN}NoSound Activé."
|
|
#fi
|
|
elif [[ $toolsuse == "7" ]]; then
|
|
clear
|
|
printf "\n ${YELLOW}/!\\ WARNING /!\\ "
|
|
printf "\n"
|
|
printf "\nEn activant cette fonctionnalité:"
|
|
printf "\n - Votre home passera en 700."
|
|
printf "\n - Votre .ssh passera en 700."
|
|
printf "\n - Votre .bashrc passera en 600."
|
|
printf "\n - Votre PSQL History sera remove."
|
|
printf "\n - Votre Bash History sera remove."
|
|
printf "\n${ENDCOLOR}"
|
|
printf "\n"
|
|
read -p "Êtes vous sur d'activer le panic button ? (Y/n) : " panicbtn
|
|
|
|
if [[ $panicbtn == "Y" ]]; then
|
|
printf "Veuillez confirmer en tapant le code si dessous."
|
|
rdmcode="$(echo $RANDOM)"
|
|
printf "\n"
|
|
echo $rdmcode
|
|
printf "\n"
|
|
read -p "Code: " code
|
|
if [[ $rdmcode == $code ]]; then
|
|
printf "\n ${RED}Le Panic Button a été activé. ${ENDCOLOR}\n\n"
|
|
printf "Set Home to 700 Perm.."
|
|
chmod 700 ~
|
|
printf "\tOk\n"
|
|
printf "Set .ssh to 700 Perm.."
|
|
chmod 700 ~/.ssh
|
|
printf "\tOk\n"
|
|
printf "Set .bashrc to 600 Perm.."
|
|
chmod 600 ~/.bashrc
|
|
printf "\tOk\n"
|
|
printf "Remove PSQL History.."
|
|
rm ~/.psql_history
|
|
printf "\tOk\n"
|
|
printf "Remove Bash History.."
|
|
rm ~/.bash_history
|
|
printf "\tOk\n"
|
|
printf "\nProtection d'urgence de la session activé."
|
|
sleep 2
|
|
clear
|
|
else
|
|
printf "\n>> ${RED}Code Invalide. ${ENDCOLOR}"
|
|
sleep 2
|
|
clear
|
|
fi
|
|
else
|
|
printf "\n>> Retour au Menu en cours.."
|
|
sleep 1
|
|
clear
|
|
fi
|
|
elif [[ $toolsuse == "8" ]]; then
|
|
clear
|
|
|
|
Aff
|
|
|
|
printf "\n▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬"
|
|
printf "\n Version 1.0.1"
|
|
printf "\n "
|
|
printf "\n DefTools est un script Bash de protection."
|
|
printf "\n Développé par Mathis Chirat"
|
|
printf "\n "
|
|
printf "\n La raison du développement de cet outils, est du"
|
|
printf "\n au grand nombre de home ouvert où l'on pouvait"
|
|
printf "\n trouver des mots de passe PSQL, des clés SSH / RSA"
|
|
printf "\n et aussi l'envoie de message et son aux autres ordinateurs."
|
|
printf "\n "
|
|
printf "\n▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬${ENDCOLOR}\n"
|
|
read -p "Entrer pour revenir au menu." enter
|
|
clear
|
|
elif [[ $toolsuse == "9" ]]; then
|
|
echo Byee !
|
|
i=1
|
|
else
|
|
printf "\n${RED}ERR0R: Undefined Tools${ENDCOLOR}\n"
|
|
sleep 1
|
|
clear
|
|
fi
|
|
|
|
done
|
|
printf "\033[0;37m"
|
|
sleep 1
|
|
clear
|
|
exit 0 |