From 1b990c96a672704c7712f64b4e2b5f09c72d59e6 Mon Sep 17 00:00:00 2001 From: drduh Date: Tue, 26 Mar 2024 16:36:25 -0700 Subject: [PATCH] Add chars and echo config options --- README.md | 2 ++ purse.sh | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 46c5f7d..147eeb5 100644 --- a/README.md +++ b/README.md @@ -72,8 +72,10 @@ Variable | Description | Default | Values `PURSE_LEN` | default generated password length | `14` | any valid integer `PURSE_COPY` | copy password to clipboard before write | unset (disabled) | `1` or `true` to enable `PURSE_DAILY` | create daily backup archive on write | unset (disabled) | `1` or `true` to enable +`PURSE_CHARS` | character set for passwords | `[:alnum:]!?@#$%^&*();:+=` | any valid characters `PURSE_COMMENT` | **unencrypted** comment to include in index and safe files | unset | any valid string `PURSE_DEST` | password output destination, will set to `screen` without clipboard | `clipboard` | `clipboard` or `screen` +`PURSE_ECHO` | character used to echo password input | `*` | any valid character `PURSE_SAFE` | safe directory name | `safe` | any valid string `PURSE_INDEX` | index file name | `purse.index` | any valid string `PURSE_BACKUP` | backup archive file name | `purse.$hostname.$today.tar` | any valid string diff --git a/purse.sh b/purse.sh index 3052c5e..a55b15a 100755 --- a/purse.sh +++ b/purse.sh @@ -12,17 +12,18 @@ today="$(date +%F)" copy="$(command -v xclip || command -v pbcopy)" gpg="$(command -v gpg || command -v gpg2)" gpg_conf="${GNUPGHOME}/gpg.conf" -pass_chars="[:alnum:]!?@#$%^&*();:+=" clip_dest="${PURSE_DEST:=clipboard}" # set to 'screen' to print to stdout clip_timeout="${PURSE_TIME:=10}" # seconds to clear clipboard/screen comment="${PURSE_COMMENT:=}" # *unencrypted* comment in files daily_backup="${PURSE_DAILY:=}" # daily backup archive on write pass_copy="${PURSE_COPY:=}" # copy password before write +pass_echo="${PURSE_ECHO:=*}" # show "*" when typing passwords pass_len="${PURSE_LEN:=14}" # default password length safe_dir="${PURSE_SAFE:=safe}" # safe directory name safe_ix="${PURSE_INDEX:=purse.index}" # index file name safe_backup="${PURSE_BACKUP:=purse.$(hostname).${today}.tar}" +pass_chars="${PURSE_CHARS:='[:alnum:]!?@#$%^&*();:+='}" trap cleanup EXIT INT TERM cleanup () { @@ -62,7 +63,7 @@ get_pass () { password="${password%?}" fi else - prompt="*" + prompt="${pass_echo}" password+="${char}" fi done