Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- #Script by Freddy87 ([email protected])
- #provides option to gpg encrypt messages straight to file or gpg encrypt selected file
- echo "Do you want to encrypt a (F)ile or (M)essage? " #Option to encrypt file or message
- read choice
- option=$(echo $choice|sed 's/\(.*\)/\L\1/') #converts input to lowercase for matching in if statement
- if [ $option = "m" ]; then
- echo "Enter the message to encrypt: " #creates file with message inside and encrypts it
- read message
- echo "Enter the name of the recipient: "
- read recipient
- echo "Enter the name of the output file: "
- read outfile
- echo "$message" | gpg -o "$outfile.gpg" --encrypt -r "$recipient"
- elif [ $option = "f" ]; then
- echo "Enter the name of the file to encrypt: " #Encrypts file (standard gpg but more user friendly)
- read file_name
- echo "Enter the recipient: "
- read recipient
- echo "Enter the name of the output file: "
- read outfile
- if [ -n "$outfile" ]; then
- gpg -o "$outfile.gpg" --encrypt -r "$recipient" "$file_name"
- elif [ -z "$outfile" ]; then
- gpg --encrypt -r "$recipient" "$file_name" #if $outfile empty then overwrite
- fi
- else
- echo "That is not a valid option"
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement