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.

77 lines
2.6 KiB

  1. #!/bin/bash
  2. ########################################################################
  3. # Copyright (C) 2015 Max Mehl <mail@mehl.mx>
  4. ########################################################################
  5. #
  6. # This program is free software: you can redistribute it and/or modify
  7. # it under the terms of the GNU General Public License as published by
  8. # the Free Software Foundation, either version 3 of the License, or
  9. # (at your option) any later version.
  10. #
  11. # This program is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. # GNU General Public License for more details.
  15. #
  16. # You should have received a copy of the GNU General Public License
  17. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  18. #
  19. ########################################################################
  20. #
  21. # Creates a graphical list of strong passwords generated by apg.
  22. # The user is able to modify the settings in the dialogue
  23. #
  24. ########################################################################
  25. function checkexit {
  26. if [ $1 = 1 ]; then exit 1; fi
  27. }
  28. if [ $(zenity --question --cancel-label "More options" --ok-label "Close" --text "$(apg -m 16 -M NCL -a 0)" --title "Generated Passwords"; echo $?) == 1 ]; then
  29. # More options requested
  30. PLEN=$(zenity --entry --text "Desired length of password(s)" --title "Enter password length")
  31. checkexit $?
  32. PALG=$(zenity --list \
  33. --text="Choose between random character or pronouncable passwords" \
  34. --title="Choose password algorithm" \
  35. --column="Option" --column="Description" \
  36. 1 "Random character passwords" \
  37. 0 "Pronouncable password algorithm" \
  38. )
  39. checkexit $?
  40. PALG=$(echo $PALG | sed 's/|//g')
  41. POPT=$(zenity --list --multiple \
  42. --text="Choose one or multiple generator options" \
  43. --title="Choose password options" \
  44. --column="Option" --column="Description" \
  45. N "Numerical" \
  46. C "Capital letters" \
  47. L "Lower case letters" \
  48. )
  49. checkexit $?
  50. POPT=$(echo $POPT | sed 's/|//g')
  51. PAMT=$(zenity --entry --text "Desired amount of generated passwords" --title "Enter password amount")
  52. checkexit $?
  53. # Set defaults if no entry was given
  54. if [ "$PLEN" == "" ]; then
  55. PLEN="16"
  56. fi
  57. if [ "$PALG" == "" ]; then
  58. PALG="1"
  59. fi
  60. if [ "$POPT" == "" ]; then
  61. POPT="NCL"
  62. fi
  63. if [ "$PAMT" == "" ]; then
  64. PAMT="6"
  65. fi
  66. # Output desired passwords
  67. $(zenity --info --text "$(apg -a $PALG -m $PLEN -M $POPT -n $PAMT)" --title "Generated Passwords")
  68. fi