summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--README6
-rwxr-xr-xangou11
-rwxr-xr-xcontrib/random22
4 files changed, 38 insertions, 2 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..b25c15b
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
*~
diff --git a/README b/README
index 08521d1..d6d1d42 100644
--- a/README
+++ b/README
@@ -12,6 +12,10 @@ Dependencies
12 - can possibly be replaced with ls if you add ANGOU_LIST in your ~/.profile 12 - can possibly be replaced with ls if you add ANGOU_LIST in your ~/.profile
13- xsel (for copying password to clipboard, but can be changed to a different 13- xsel (for copying password to clipboard, but can be changed to a different
14 command with the ANGOU_CLIPBOARD command that accepts stdin) 14 command with the ANGOU_CLIPBOARD command that accepts stdin)
15- a password generator
16 - script uses contrib/random from this repo by default and expects it in your
17 path
18 - can change by setting ANGOU_GEN_USER and ANGOU_GEN_PASS in your ~/.profile
15 19
16Configuration 20Configuration
17------------- 21-------------
@@ -42,4 +46,4 @@ Set the ANGOU_DIR environment variable to your password store directory.
42Auto-complete 46Auto-complete
43------------- 47-------------
44If you use ksh, all you'd have to do is source contrib/autocomplete.ksh in your 48If you use ksh, all you'd have to do is source contrib/autocomplete.ksh in your
45kshrc. \ No newline at end of file 49kshrc.
diff --git a/angou b/angou
index 845670b..c1d06fc 100755
--- a/angou
+++ b/angou
@@ -6,6 +6,9 @@ ANGOU_DIR=${ANGOU_DIR:-"$HOME/.angou/"}
6ANGOU_CLIPBOARD=${ANGOU_CLIPBOARD:-"xsel -i"} 6ANGOU_CLIPBOARD=${ANGOU_CLIPBOARD:-"xsel -i"}
7# sets command to use when listing directory structure 7# sets command to use when listing directory structure
8ANGOU_LIST=${ANGOU_LIST:-"tree"} 8ANGOU_LIST=${ANGOU_LIST:-"tree"}
9# custom command for generating passwords/users
10ANGOU_GEN_PASS=${ANGOU_GEN_PASS:-"random pass"}
11ANGOU_GEN_USER=${ANGOU_GEN_USER:-"random user"}
9 12
10mkdir -p "$ANGOU_DIR" 13mkdir -p "$ANGOU_DIR"
11cd "$ANGOU_DIR" || exit 14cd "$ANGOU_DIR" || exit
@@ -35,6 +38,11 @@ edit() {
35 38
36 tmpfile="$(mktemp)" 39 tmpfile="$(mktemp)"
37 40
41 if [ "$2" = "generate" ]; then
42 $ANGOU_GEN_PASS >"$tmpfile"
43 echo "Username: $($ANGOU_GEN_USER)" >>"$tmpfile"
44 fi
45
38 # edit a copy of a password if it already exists 46 # edit a copy of a password if it already exists
39 [ -f "$1" ] && $ANGOU_DECRYPT "$1" > "$tmpfile" 47 [ -f "$1" ] && $ANGOU_DECRYPT "$1" > "$tmpfile"
40 48
@@ -46,7 +54,7 @@ edit() {
46 54
47# print usage 55# print usage
48usage() { 56usage() {
49 printf "Usage: %s [help|copy|edit|view [file or directory]]\n" "$0" 57 printf "Usage: %s [help|copy|edit|generate|view [file or directory]]\n" "$0"
50 printf "\tThe edit and copy command expects a file as an argument,\n" 58 printf "\tThe edit and copy command expects a file as an argument,\n"
51 printf "\twhile the view command expects a directory as an argument.\n" 59 printf "\twhile the view command expects a directory as an argument.\n"
52 printf "\tThe arguments for view and edit are relative to\n" 60 printf "\tThe arguments for view and edit are relative to\n"
@@ -61,6 +69,7 @@ case "$option" in
61 help) usage ;; 69 help) usage ;;
62 copy) copy "$2" ;; 70 copy) copy "$2" ;;
63 edit) edit "$2" ;; 71 edit) edit "$2" ;;
72 generate) edit "$2" generate ;;
64 view) view "$2" ;; 73 view) view "$2" ;;
65 *) view "$1" ;; 74 *) view "$1" ;;
66esac 75esac
diff --git a/contrib/random b/contrib/random
new file mode 100755
index 0000000..10ddda7
--- /dev/null
+++ b/contrib/random
@@ -0,0 +1,22 @@
1#!/bin/sh
2# Simple random string generator for passwords and usernames
3# $LEN initial declaration commented out for runtime LEN config
4
5LC_ALL=C
6#LEN=${LEN:-24}
7ALPHA="A-Za-z"
8NUM="0-9"
9SPECIAL='!"#$%&'\''()*+,-./:;<=>?@[\]^_`{|}~'
10
11random() {
12 </dev/urandom tr -dc "${ALPHA}${NUM}${SPECIAL}" | /bin/dd bs=1 count=${LEN:-32} 2>/dev/null ; echo
13}
14
15case $1 in
16 pass)
17 random ;;
18 user)
19 LEN=${LEN:-12} SPECIAL='' random ;;
20 *)
21 printf "Usage: $0 pass|user\nSet LEN environment variable for length" ;;
22esac