diff --git a/deftools.sh b/deftools.sh new file mode 100644 index 0000000..7387a51 --- /dev/null +++ b/deftools.sh @@ -0,0 +1,270 @@ +#!/bin/bash + +clear + +RED="\e[31m" +GREEN="\e[32m" +YELLOW="\e[33m" +CYAN="\e[36m" +ENDCOLOR="\e[0m" + +Aff() { + 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) • ${RED}Comming Soon..${ENDCOLOR}" + 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_psqlpwd="$(cat ~/.psql_history | grep 'WITH PASSWORD' | wc -l)" + cmdpanel_bashrc="$(ls -ld ~/.bashrc | grep -o '^\S*')" + clear + Aff + printf "\n▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬\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 + printf "\n ${GREEN}• ${ENDCOLOR}PSQL PASSWORD Protection" + else + printf "\n ${RED}• ${ENDCOLOR}PSQL PASSWORD Protection" + 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" ]]; 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)" + if [[ $cmdpanel_msg == "0" ]]; then + printf "\n> ${ENDCOLOR}CMD Message Protection ${GREEN}Enable ${ENDCOLOR}\n" + else + printf "\n> ${ENDCOLOR}CMD Message Protection ${RED}Disable ${ENDCOLOR}\n" + fi + read -p "Disable / Enable / Exit : " cmdmed + if [[ $cmdmed == "Disable" ]]; then + mesg on + printf "\n> ${RED} CMD Message Protection Disable ! ${ENDCOLOR}\n" + elif [[ $cmdmed == "Enable" ]]; then + mesg no + printf "\n> ${GREEN} CMD Message Protection Ensable ! ${ENDCOLOR}\n" + elif [[ $cmdmed == "Exit" ]]; 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*')" + if [[ $cmdpanel_ssh == "drwx------" ]]; then + printf "\n> ${ENDCOLOR}SSH File Protection ${GREEN}Enable ${ENDCOLOR}\n" + else + printf "\n> ${ENDCOLOR}SSH File Protection ${RED}Disable ${ENDCOLOR}\n" + fi + read -p "Disable / Enable / Exit : " sshproct + if [[ $sshproct == "Disable" ]]; 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 == "Enable" ]]; then + chmod 700 ~/.ssh + printf "Protection du .ssh ${GREEN}activé${ENDCOLOR}" + sleep 1 + elif [[ $sshproct == "Exit" ]]; then + j=1 + else + printf "\n ${RED} ERR0R Invalide Input${ENDCOLOR}" + fi + done + clear + elif [[ $toolsuse == "4" ]]; then + 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 [[ $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 + 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*')" + if [[ $cmdpanel_bashrc == "-rwx------" || $cmdpanel_bashrc == "-rw-------" ]]; then + printf "\n> ${ENDCOLOR}BASHRC Protection ${GREEN}Enable ${ENDCOLOR}\n" + else + printf "\n> ${ENDCOLOR}BASHRC Protection ${RED}Disable ${ENDCOLOR}\n" + fi + read -p "Disable / Enable / Exit : " bashrcproct + if [[ $bashrcproct == "Disable" ]]; 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 == "Enable" ]]; then + chmod 600 ~/.bashrc + printf "Protection du .bashrc ${GREEN}activé${ENDCOLOR}" + sleep 1 + elif [[ $bashrcproct == "Exit" ]]; then + j=1 + else + printf "\n ${RED} ERR0R Invalide Input${ENDCOLOR}" + fi + done + clear + elif [[ $toolsuse == "7" ]]; then + printf "\n ${YELLOW}/!\\ WARNING /!\\ " + printf "\n" + printf "\nEn activant cette fonctionnalité tout vos fichiers passerons en 700." + printf "\nSeul vous y aurez donc accès. ${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 + chmod -R 700 ~ + printf "\n ${RED}Le Panic Button a été activé. ${ENDCOLOR}" + 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 " + 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 \ No newline at end of file