🔒 A "Automated Password Generator"-clone written in Go
Find a file
Winni Neessen 9277e83fd4
v0.3.1: New password length behaviour
To address issue #13, the password length behaviour of the
original APG has been reproduced. Previously, when a minLength
of 5 and a maxLength of 10 was given, apg-go se the pwLength to
the preferred maxLength.

With v0.3.1 it will choose a random length between minLength and
maxLength instead, same as the original C-lang apg did. For this
the minLength has been defaulted to a sane value of 12 (instead
of the 8 of the original apg). The default for maxLength stayed
at 20.

Also the default number of generated passwords has been changed
from 1 to 6, to replicate the behaviour of the original apg.
2021-04-17 11:04:14 +02:00
.github/workflows Update go.yml 2021-03-26 14:30:43 +01:00
.idea v0.3.1: New password length behaviour 2021-04-17 11:04:14 +02:00
buildfiles/arch-linux Updated PKGBUILD for 0.3.0 2021-04-01 11:01:47 +02:00
.gitignore Removed .idea from .gitignore 2021-03-27 17:11:59 +01:00
apg.go v0.3.0: Unified the naming convention 2021-04-01 10:53:51 +02:00
apg_test.go v0.3.1: New password length behaviour 2021-04-17 11:04:14 +02:00
chars.go v0.2.8: De-cluttered the config flags stuff 2021-03-27 17:03:19 +01:00
config.go v0.3.1: New password length behaviour 2021-04-17 11:04:14 +02:00
convert.go Added spelling of pws. Ready for v0.2.4 2021-03-21 15:28:23 +01:00
go.mod v0.3.1: New password length behaviour 2021-04-17 11:04:14 +02:00
LICENSE Initial commit 2021-03-18 23:13:10 +01:00
rand.go Split up functions into seperate files 2021-03-21 14:05:14 +01:00
README.md v0.3.1: New password length behaviour 2021-04-17 11:04:14 +02:00

A "Automated Password Generator"-clone

Go workflow CodeQL workflow

apg-go is a simple APG-like password generator written in Go. It tries to replicate the functionality of the "Automated Password Generator", which hasn't been maintained since 2003. Since more and more Unix distributions are abondoning the tool, I was looking for an alternative. FreeBSD for example recommends "security/makepasswd", which is written in Perl but requires a lot of dependency packages and doesn't offer the feature-set/flexibility of APG.

Since FIPS-181 (pronouncable passwords) has been withdrawn in 2015, I didn't see any use in replicating that feature. Therfore apg-go does not support pronouncable passwords.

Installation

Binary releases

Linux/BSD/MacOS

  • Download release
    $ curl -LO https://github.com/wneessen/apg.go/releases/download/v<version>/apg-v<version>-<os>-<architecture>.tar.gz
    $ curl -LO https://github.com/wneessen/apg.go/releases/download/v<version>/apg-v<version>-<os>-<architecture>.tar.gz.sha256
    
  • Verify the checksum
    $ sha256 apg-v<version>-<os>-<architecture>.tar.gz 
    $ cat apg-v<version>-<os>-<architecture>.tar.gz.sha256
    
    Make sure the checksum of the downloaded file and the checksum in the .sha256 match
  • Extract archive
    $ tar xzf apg-v<version>-<os>-<architecture>.tar.gz
    
  • Execute
    $ ./apg
    

Windows

  • Download release
    PS> Invoke-RestMethod -Uri https://github.com/wneessen/apg.go/releases/download/v<version>/apg-v<version>-windows-<architecture>.zip -OutFile apg-v<version>-windows-<architecure>.zip
    PS> Invoke-RestMethod -Uri https://github.com/wneessen/apg.go/releases/download/v<version>/apg-v<version>-windows-<architecture>.zip.sha256 -OutFile apg-v<version>-windows-<architecure>.zip.sha256
    
  • Verify the checksum
    PS> Get-FileHash apg-v<version>-windows-<architecture>.zip | Format-List
    PS> type apg-v<version>-windows-<architecture>.zip.sha256
    
    Make sure the checksum of the downloaded file and the checksum in the .sha256 match
  • Extract archive
    PS> Expand-Archive -LiteralPath apg-v<version>-windows-<architecture>
    
  • Execute
    PS> cd apg-v<version>-windows-<architecture> 
    PS> apg.exe
    

Sources

  • Download sources
    $ curl -LO https://github.com/wneessen/apg.go/archive/refs/tags/v<version>.tar.gz
    
  • Extract source
    $ tar xzf v<version>.tar.gz
    
  • Build binary
    $ cd apg.go-<version>
    $ go build -o apg ./...
    
  • Execute the brand new binary
    $ ./apg
    

Systemwide installation

It is recommed to install apg in a directory of your $PATH environment. To do so run: (In this example we use /usr/local/bin as system-wide binary path. YMMV)

$ sudo cp apg /usr/local/bin/apg

CLI parameters

apg.go replicates some of the parameters of the original APG. Some parameters are different though:

  • -m <length>: The minimum length of the password to be generated (Default: 12)
  • -x <length>: The maximum length of the password to be generated (Default: 20)
  • -n <number of passwords>: The amount of passwords to be generated (Default: 6)
  • -E <list of characters>: Do not use the specified characters in generated passwords
  • -M <[LUNSHClunshc]>: New style password parameters (upper-case enables, lower-case disables)
  • -L: Use lower-case characters in passwords (Default: on)
  • -U: Use upper-case characters in passwords (Default: on)
  • -N: Use numeric characters in passwords (Default: on)
  • -S: Use special characters in passwords (Default: off)
  • -H: Avoid ambiguous characters in passwords (i. e.: 1, l, I, o, O, 0) (Default: off)
  • -C: Generate complex passwords (implies -L -U -N -S and disables -H) (Default: off)
  • -l: Spell generated passwords (Default: off)
  • -h: Show a CLI help text
  • -v: Show the version number