Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- clear
- echo "
- ##########################################################################
- # Password Keeper #
- # #
- ##########################################################################"
- gpg --version >/dev/null || { echo "This program requires gpg"; exit 1; }
- createDir() {
- if [ ! -d ~/Documents/PasswordKeeper ]; then
- mkdir ~/Documents/PasswordKeeper
- echo "Created ~/Documents/PasswordKeeper"
- sleep 1
- fi
- intro
- }
- enterPass(){
- echo "Enter the website or username:"
- read lock | grep -q "[[:space:]]" || echo "No spaces. Try again"; read lock;
- echo "Enter the password:"
- read -s key
- echo "Repeat password:"
- read -s repeatKey
- while [ $key != $repeatKey ]
- do
- echo "Passwords did not match. Enter password again:"
- read -s repeatKey
- done
- touch $lock.txt; echo $key > $lock.txt
- mv $lock.txt ~/Documents/PasswordKeeper
- clear
- echo -e "Enter Master Password to encrypt:\n"
- gpg -c ~/Documents/PasswordKeeper/"$lock.txt"
- rm -rf ~/Documents/PasswordKeeper/"$lock.txt"
- echo "Done!"
- sleep 1
- intro
- }
- viewPass(){
- ls ~/Documents/PasswordKeeper
- echo -e "\nChoose a file:"
- read choice
- gpg --decrypt ~/Documents/PasswordKeeper/$choice*
- echo -e "\nPress any key to continue"; read ;
- clear; clear;
- intro
- }
- intro(){
- echo "1) View password"
- echo "2) Enter new password"
- echo "3) Exit"
- read choice
- case $choice in
- 1) clear; viewPass ;;
- 2) clear; enterPass ;;
- 3) clear; exit 1 ;;
- *) clear; intro ;;
- esac
- }
- createDir
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement