Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #
- # author: Samuel Gaehwiler
- # www.klangfreund.com
- #
- # dependencies:
- # 7za
- # (on OS X, get it via 'brew install p7zip')
- #
- # usage:
- # ./encrypt.sh
- #
- # To decrypt, use e.g. 'The Unarchiver.app' from the App Store.
- password=replaceThisWithYourMasterPassword
- dateAndTime=$(date +\%y\%m\%d_\%H\%M\%S)
- # Compress and encrypt
- # --------------------
- # Source: http://xmodulo.com/how-to-create-encrypted-zip-file-on-linux.html
- backupFileName=$(date +\%y\%m\%d_\%H\%M\%S)_Samuel_Gaehwiler_encrypted.zip
- returnText=$(7za a -tzip -p$password -mem=AES256 $backupFileName encrypt.sh payload/*)
- echo $returnText
- # Be aware that the list of file names can be viewed without knowing the password!
- # unzip -l <filename>.zip
- #
- # source: http://security.stackexchange.com/questions/35818/are-password-protected-zip-files-secure/35879#35879
- # Delete the payload if the encryption went well.
- # -----------------------------------------------
- zipSuccessfullyCreated="Everything is Ok"
- if test "${returnText#*$zipSuccessfullyCreated}" != "$returnText"
- then
- rm -r encrypt.sh payload
- else
- echo "The creation of the encoded zip file did not work. Reason unknown."
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement