Files
gpassgen/gpassgen.sh
T

59 lines
2.1 KiB
Bash
Executable File

#!/bin/bash
########################################################################
# Copyright (C) 2015 Max Mehl <mail@mehl.mx>
########################################################################
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
########################################################################
#
# Creates a graphical list of strong passwords generated by apg.
# The user is able to modify the settings in the dialogue
#
########################################################################
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