Files
gpassgen/gpassgen.sh
T

35 lines
1.0 KiB
Bash
Raw Normal View History

2015-04-13 11:47:00 +03:00
#!/bin/bash
cd "$(dirname "$(readlink -f "$0")")"
if [ $(zenity --question --cancel-label "More options" --ok-label "Close" --text "$(apg -m 16 -M NCL -a 1)" --title "Generated Passwords"; echo $?) == 1 ]; then
# More options requested
echo $POPT
PLEN=$(zenity --entry --text "Desired length of password(s)" --title "Enter password length")
POPT=$(zenity --list --multiple \
--text="Choose one or multiple generator options" \
--title="Choose password options" \
--column="Option" --column="Description" \
N "Numerical" \
C "Capital letters" \
L "Lower case letters" \
)
POPT=$(echo $POPT | sed 's/|//g')
PAMT=$(zenity --entry --text "Desired amount of generated passwords" --title "Enter password amount")
# Set defaults if no entry was given
if [ "$PLEN" == "" ]; then
PLEN="12"
fi
if [ "$POPT" == "" ]; then
POPT="NCL"
fi
if [ "$PAMT" == "" ]; then
PAMT="6"
fi
# Output desired passwords
$(zenity --info --text "$(apg -a 1 -m $PLEN -M $POPT -n $PAMT)" --title "Generated Passwords")
fi