#!/bin/bash # ./dirpw - reminder of how the script launches from my home folder # My Business 05/12/14 # Ccrypt Encrypt-Decrypt Directory clear # set the Bash color variables bold=$(tput bold) red=$(tput setaf 1) green=$(tput setaf 2) yellow=$(tput setaf 3) blue=$(tput setaf 4) purple=$(tput setaf 5) cyan=$(tput setaf 6) white=$(tput setaf 7) reset=$(tput sgr0) loopy="y" # initialize while loop while [[ "$loopy" == "y" || "$loopy" == "Y" ]] do echo "" echo " ${bold}${blue}My Business${reset} ${bold}${white}- Password Directory${reset}" echo "" echo " --------------------------------" echo "" # menu options echo " ${bold}${white}1${reset} ${bold}${cyan}Customers${reset}" echo " ${bold}${white}2${reset} ${bold}${yellow}Personal${reset}" echo " ${bold}${white}3${reset} ${bold}${green}Encrypt a File${reset}" echo " ${bold}${white}4${reset} ${bold}${red}Decrypt a File${reset}" echo "" echo " ${bold}${white}0${reset} ${bold}${white}Exit${reset}" echo "" echo -n " Enter your whole number choice (${bold}${white}1 - 4 or 0${reset}): " read pwfile if [ $pwfile -lt 0 -o $pwfile -gt 4 ]; then echo " Your choice of $pwfile is out of range. Please run this script again." fi echo "" case "$pwfile" in "1" ) cd ~ cd Desktop/pw echo -n "Verify by typing a few letters that you are NOT using Caps Lock: ${bold}${red}" read typingtest echo "${reset}${bold}${cyan}Decrypting the Customers Password File...${reset}${bold}${red}" ccrypt -d Customers.cpt echo "${reset}" gedit Customers echo -n "Verify by typing a few letters that you are NOT using Caps Lock: ${bold}${red}" read typingtest echo "${reset}${bold}${cyan}Re-encrypting the Customers Password File...${reset}${bold}${green}" ccrypt -e Customers echo "${reset}${bold}${green}" echo `date +"%m-%d-%y at %H:%M"` "Password File: 'Customers' re-encrypted" >> pwlog ls echo "${reset}" ;; "2" ) cd ~ cd Desktop/pw echo -n "Verify by typing a few letters that you are NOT using Caps Lock: ${bold}${red}" read typingtest echo "${reset}${bold}${cyan}Decrypting the Personal Password File...${reset}${bold}${red}" ccrypt -d Personal.cpt echo "${reset}" gedit Personal echo -n "Verify by typing a few letters that you are NOT using Caps Lock: ${bold}${red}" read typingtest echo "${reset}${bold}${cyan}Re-encrypting the Personal Password File...${reset}${bold}${green}" ccrypt -e Personal echo "${reset}${bold}${green}" echo `date +"%m-%d-%y at %H:%M"` "Password File: 'Personal' re-encrypted" >> pwlog ls echo "${reset}" ;; "3" ) cd ~ echo "Encrypt an unencrypted file" echo "" cd ~ echo -n "Indicate the Directory Folder you want to 'cd' to. ${bold}${green}" read myfolder echo "${reset}" cd $myfolder ls echo "" echo -n "From this listing, what is the file's name? ${bold}${yellow}" read myfile echo "${reset}${bold}${cyan}Encrypting $myfile: ${reset}${bold}${green}" ccrypt -e $myfile echo "${reset}${bold}${green}" echo `date +"%m-%d-%y at %H:%M"` "Password File: '$myfile' encrypted" >> pwlog ls echo "${reset}" ;; "4" ) cd ~ echo "Decrypt an encrypted file" echo "" cd ~ echo -n "Indicate the Directory Folder you want to 'cd' to. ${bold}${green}" read myfolder echo "${reset}" cd $myfolder ls echo "" echo -n "From this listing, what is the file's name? ${bold}${yellow}" read myfile echo "${reset}${bold}${cyan}Decrypting $myfile: ${reset}${bold}${red}" ccrypt -d $myfile echo "${reset}${bold}${green}" echo `date +"%m-%d-%y at %H:%M"` "Password File: '$myfile' decrypted" >> pwlog ls echo "${reset}" ;; "0" ) exit ;; esac done exit 0