1
0
mirror of https://github.com/octoleo/Purse.git synced 2024-12-28 20:12:38 +00:00

Add license. Update dependencies to include srm. Set secure umask. Remove superfluous main method.

This commit is contained in:
drduh 2015-07-02 17:47:32 -04:00
parent 847d5fe8f6
commit 4fbec3ee54
3 changed files with 37 additions and 25 deletions

19
LICENSE.md Normal file
View File

@ -0,0 +1,19 @@
Copyright (c) 2015 drduh
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@ -8,6 +8,8 @@ This script uses GPG to manage an encrypted text file containing passwords.
# Requirements
Requires `gpg`. Install with `brew install gpg` or `apt-get install gnupg` or build and install it from [source](https://www.gnupg.org/download/index.html).
Requires `srm`. Install with `apt-get install secure-delete`. Already included in OS X.
# Installation
git clone https://github.com/drduh/pwd.sh && cd pwd.sh

41
pwd.sh
View File

@ -11,10 +11,10 @@ safe=pwd.sh.safe
public=pwd.sh.pub
secret=pwd.sh.sec
del=/usr/bin/srm
del=$(which srm)
del_opts=("--force --zero")
gpg=/usr/local/bin/gpg
gpg=$(which gpg)
gpg_opts=("--no-default-keyring --keyring ./${public} --secret-keyring ./${secret}")
name="nobody@pwd.sh"
@ -174,13 +174,13 @@ create_safe () {
sanity_check () {
# Make sure all necessary programs are installed and files exist.
if [ ! -x ${gpg} ] ; then
if [[ -z ${gpg} && ! -x ${gpg} ]] ; then
echo "GnuPG is not available!"
exit 127
fi
if [ ! -x ${del} ] ; then
echo "srm/rm is not available!"
if [[ -z ${del} && ! -x ${del} ]] ; then
echo "srm is not available!"
exit 127
fi
@ -200,25 +200,16 @@ sanity_check () {
}
main () {
# Main function.
sanity_check
sanity_check
read -p "Read, write, or delete a password? (r/w/d default: r) " action
if [ "${action}" == "w" ] ; then
create_id
write_pass
elif [ "${action}" == "d" ] ; then
read -p "Which Username/ID to delete? " id
write_pass
else
read_pass
fi
}
main
exit 0
read -p "Read, write, or delete a password? (r/w/d default: r) " action
if [ "${action}" == "w" ] ; then
create_id
write_pass
elif [ "${action}" == "d" ] ; then
read -p "Which Username/ID to delete? " id
write_pass
else
read_pass
fi