new method of generating a password; 5 random words from dict.

This commit is contained in:
NunoSempere 2023-06-23 17:44:44 +01:00
parent 0553ef84f2
commit dd3297e81a

View File

@ -64,14 +64,16 @@ cmd_append_append() {
else
ARGS="$@"
charstring1='"'
charstring2="\!#\$&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_\`abcdefghijklmnopqrstuvwxyz{|}~"
characters="$charstring1$charstring2"
length=25
read -r -n $length new_password < <(LC_ALL=C tr -dc "$characters" < /dev/urandom)
# old method of generating a password:
# charstring1='"'
# charstring2="\!#\$&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_\`abcdefghijklmnopqrstuvwxyz{|}~"
# characters="$charstring1$charstring2"
# length=25
# read -r -n $length new_password < <(LC_ALL=C tr -dc "$characters" < /dev/urandom)
# new method:
new_password=$(cat /usr/share/dict/words | sed "s|'s||g" | shuf -n6 | sed -z 's/\n/-/g;s/-$/\n/' | tr '[:upper:]' '[:lower:]')
printf "$new_password" | xclip -sel clip
echo "Copied new password to clipboard: "
echo "$new_password"