Update 2024-02-14 07:51 OpenBSD/amd64-x13
This commit is contained in:
32
.bin/OLD/pwadd
Executable file
32
.bin/OLD/pwadd
Executable file
@@ -0,0 +1,32 @@
|
||||
#!/bin/sh
|
||||
|
||||
_ask() {
|
||||
# $1 question
|
||||
# $2 default value
|
||||
if [ -z $1 ]; then
|
||||
printf "$1: "
|
||||
else
|
||||
printf "$1 [$2]: "
|
||||
fi
|
||||
}
|
||||
|
||||
_ask "Url" "$1"
|
||||
read url
|
||||
[ -z $url ] && url="$1"
|
||||
|
||||
_ask "User" "$2"
|
||||
read user
|
||||
[ -z $user ] && user="$2"
|
||||
|
||||
if [ -z $user ] || [ -z $url ]; then
|
||||
print "User and URL must be set."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
PW="$(pwgen -y --remove-chars=\~\`\"\'{}\(\)\[\]\*:/.\;\|,\<\> 24)
|
||||
|
||||
User: $user"
|
||||
|
||||
printf '%s\n' "$PW" | pass insert -fm Internet/$url 1> /dev/null
|
||||
pass Internet/$url | head -1 | xclip
|
||||
print "Password copied."
|
||||
Reference in New Issue
Block a user