Graphical frontend for the CLI tool adb with Zenity
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

76 lines
2.6 KiB

#!/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
#
########################################################################
function checkexit {
if [ $1 = 1 ]; then exit 1; fi
}
if [ $(zenity --question --cancel-label "More options" --ok-label "Close" --text "$(apg -m 16 -M NCL -a 0)" --title "Generated Passwords"; echo $?) == 1 ]; then
# More options requested
PLEN=$(zenity --entry --text "Desired length of password(s)" --title "Enter password length")
checkexit $?
PALG=$(zenity --list \
--text="Choose between random character or pronouncable passwords" \
--title="Choose password algorithm" \
--column="Option" --column="Description" \
1 "Random character passwords" \
0 "Pronouncable password algorithm" \
)
checkexit $?
PALG=$(echo $PALG | sed 's/|//g')
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" \
)
checkexit $?
POPT=$(echo $POPT | sed 's/|//g')
PAMT=$(zenity --entry --text "Desired amount of generated passwords" --title "Enter password amount")
checkexit $?
# Set defaults if no entry was given
if [ "$PLEN" == "" ]; then
PLEN="16"
fi
if [ "$PALG" == "" ]; then
PALG="1"
fi
if [ "$POPT" == "" ]; then
POPT="NCL"
fi
if [ "$PAMT" == "" ]; then
PAMT="6"
fi
# Output desired passwords
$(zenity --info --text "$(apg -a $PALG -m $PLEN -M $POPT -n $PAMT)" --title "Generated Passwords")
fi