aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDennis Eriksen <d@ennis.no>2018-06-18 21:54:51 +0200
committerDennis Eriksen <d@ennis.no>2018-06-18 21:54:51 +0200
commit0ad9488cbbeafd48da477af30f0eb57668eadd2b (patch)
tree0730d4ea09d8cee869e2dc1ccedd8584191c4415
parentno more quotes in passwords (diff)
downloadmakepass-0ad9488cbbeafd48da477af30f0eb57668eadd2b.tar.gz
testing out a passphrase-generating makepass
-rwxr-xr-xbin/bin/makepass8
1 files changed, 8 insertions, 0 deletions
diff --git a/bin/bin/makepass b/bin/bin/makepass
index 2b48456..d798b9a 100755
--- a/bin/bin/makepass
+++ b/bin/bin/makepass
@@ -19,6 +19,8 @@
# makepass-function
function makepass {
local l=$1
+ local words
+ MAKEPASS_WORDLIST=${MAKEPASS_WORDLIST:-/usr/share/dict/words}
# if $l is not a number, then exit
[[ ! $l =~ ^[0-9]+$ ]] && [[ ! "$l" == "" ]] && echo "not a number" && return 1
# if $1 is actually empty, set $l to random value for each output
@@ -30,6 +32,12 @@ function makepass {
[ "$1" = "" ] && l=$(shuf -i 16-64 -n 1)
< /dev/urandom tr -dc '!#$%&/()=?+-_,.;:<>[]{}|\@*^A-Z-a-z-0-9' | head -c${1:-$l};echo;
done;
+ if [ -r "${MAKEPASS_WORDLIST}" ]; then
+ for i in {1..5}; do
+ words=$(shuf -n 8 "${MAKEPASS_WORDLIST}" | tr '\n' '-' | tr -dc 'A-Z-a-z-0-9')
+ echo "${words:0:-1}"
+ done;
+ fi
}
makepass "${@:-}"