APG(1)

๐ŸŽ€ APG(1) โ€” apg โœจ

okay bestie, let's get into apg ๐Ÿ’… it's the tool that generates a whole bunch of random passwords for you at once. no cap, it's giving main character energy ๐Ÿฆ‹


๐ŸŒธ NAME

apg - generates several random passwords ๐Ÿ’–


โœจ SYNOPSIS

apg [-a algorithm] [-M mode] [-E char_string] [-n num_of_pass] [-m
min_pass_len] [-x max_pass_len] [-r dictfile] [-b filter_file] [-p
min_substr_len] [-s] [-c cl_seed] [-d] [-y] [-l] [-t] [-k] [-q] [-h]
[-v]

๐Ÿ’œ DESCRIPTION

okay so apg generates several random passwords ๐Ÿ”ฅ it has two password generation algorithms and a built-in pseudo random number generator. literally iconic ๐Ÿ‘‘

the default algorithm is the pronounceable password generation algorithm designed by Morrie Gasser ๐Ÿงš it's described in A Random Word Generator For Pronounceable Passwords from the National Technical Information Service (NTIS) AD-A-017676. ngl that paper is super old and was never put online, so the author had to use the NIST implementation described in FIPS-181 ๐Ÿ’€

the other algorithm is a simple random character generator, but it uses four user-defined symbol sets to make the password. so YOU get to pick what kinds of symbols show up ๐ŸŽ€ the sets are:

  • numeric symbol set (0,...,9)
  • capital letters symbol set (A,...,Z)
  • small letters symbol set (a,...,z)
  • special symbols symbol set (#,@,!,...)

the built-in pseudo random number generator is an implementation of the algorithm from Appendix C of ANSI X9.17 or RFC1750, except it uses CAST or SHA-1 instead of Triple DES ๐Ÿ“ it grabs the local time with microsecond precision (see gettimeofday(2)) and /dev/random (if available) to make the initial random seed. the vibe is very secure ๐Ÿซถ

apg can also check how good a generated password is by using a dictionary ๐ŸŒˆ you can do this by passing -r dictfile or -b filtername, where dictfile is the dictionary file name and filtername is the name of a Bloom filter file. in the dictionary you can put words (one per line) that should not show up in your passwords, like user names, common words, etc. you can even use one of the dictionaries that come with dictionary password crackers ๐Ÿ˜ญ Bloom filter files should be created with apgbfm(1), which comes with the apg distribution. the author also plans to add other checks (like pattern check) in future releases to make life easier โœจ


๐Ÿฆ‹ OPTIONS

๐ŸŒˆ Password generation modes options

  • -a algorithm โ€” pick the algorithm for password generation.
    • 0 - (default) pronounceable password generation
    • 1 - random character password generation
  • -n num_of_pass โ€” generate num_of_pass passwords. default is 6 ๐Ÿ“
  • -m min_pass_len โ€” generate passwords with a minimum length of min_pass_len. if min_pass_len > max_pass_len, then max_pass_len = min_pass_len. default minimum password length is 8 ๐Ÿ’…
  • -x max_pass_len โ€” generate passwords with a maximum length of max_pass_len. if min_pass_len > max_pass_len, then max_pass_len = min_pass_len. default maximum password length is 10 โœจ
  • -M mode โ€” use the symbol sets specified by mode when generating passwords. mode is a text string made of the characters S, s, N, n, C, c, L, l. here's what they mean:
    • S โ€” the generator must use the special symbol set for every generated password.
    • s โ€” the generator should use the special symbol set for password generation.
    • N โ€” the generator must use the numeral symbol set for every generated password.
    • n โ€” the generator should use the numeral symbol set for password generation.
    • C โ€” the generator must use the capital symbol set for every generated password.
    • c โ€” the generator should use the capital symbol set for password generation.
    • L โ€” the generator must use the small letters symbol set for every generated password (always present if the pronounceable algorithm is used) ๐Ÿงš
    • l โ€” the generator should use the small letters symbol set for password generation.
    • R,r โ€” not supported anymore ๐Ÿ’€ use the -E char_string option instead.
    • mode can't be more than 4 characters long.
heads up: using L, M, N, C will slow down the password generation process ๐Ÿข

examples: -M sncl, -M SNCL, or -M Cn ๐ŸŽ€

  • -E char_string โ€” exclude the characters in char_string from password generation (in pronounceable mode you can't exclude small letters). to include special symbols that the shell would otherwise mess with (apostrophe, quotes, dollar sign, etc.) in char_string, use the backslashed versions ๐Ÿ™ˆ

examples:

running apg -a 1 -M n -n 3 -m 8 -E 23456789 gives you passwords that look like this:

10100110
01111000
11011101

running apg -a 1 -M nc -n 3 -m 26 -E GHIJKLMNOPQRSTUVWXYZ gives you passwords that look like this:

16A1653CD4DE5E7BD9584A3476
C8F78E06944AFD57FB9CB882BC
8C8DF37CD792D36D056BBD5002

๐Ÿ” Password quality control options

  • -k โ€” check every generated password with cracklib. to use this you must enable cracklib support when building the program. (the original says "programm," we'll let it slide ๐Ÿ˜ญ)
  • -r dictfile โ€” check generated passwords for appearing in dictfile ๐Ÿ“–
  • -b filter_file โ€” check generated passwords for appearing in filter_file. the filter_file should be created with apgbfm(1) ๐ŸŒธ
  • -p min_substr_len โ€” tells apg(1) to check every substring of the generated password against filter_file. if any of those substrings show up in the filter file, the password gets rejected and apg(1) makes another one. min_substr_len is the minimum substring length to check. this option only works if -b is set ๐Ÿ’œ

๐Ÿงš Pseudo random number generator options

  • -s โ€” ask the user for a random sequence to use when generating passwords ๐ŸŽฒ
  • -c cl_seed โ€” use cl_seed as the random seed for password generation. the author uses it when generating passwords in a shell script ๐Ÿ“

๐ŸŽ€ Password output options

  • -d โ€” do NOT use any delimiters between generated passwords. the author uses this for shell scripts too ๐Ÿซถ
  • -y โ€” print generated passwords and their crypted versions (see crypt(3)) ๐Ÿ”ฅ
  • -q โ€” quiet mode, don't print warnings ๐Ÿคซ
  • -l โ€” spell out the generated passwords. super useful if you need to read a password over the phone ๐Ÿ“ž
WARNING: think twice before reading your password over the phone ๐Ÿ’€
  • -t โ€” print the pronunciation of the generated pronounceable password ๐Ÿ—ฃ๏ธ
  • -h โ€” print help info and exit ๐ŸŒท
  • -v โ€” print version info and exit ๐ŸŒŸ

๐Ÿ‘‘ DEFAULT OPTIONS

the default options are apg -a 0 -M sncl -n 6 -x 10 -m 8 (new style) โœจ

if you want to generate really secure passwords, use the -s option ๐Ÿ” to make life simpler you can write a tiny shell script, for example:

[begin]----> pwgen.sh
#!/bin/sh
/usr/local/bin/apg -m 8 -x 12 -s
[ end ]----> pwgen.sh

๐Ÿšฆ EXIT CODE

when apg finishes its job successfully, it exits with code 0. an exit code of -1 means an error happened. text errors get written to the standard error stream ๐Ÿšจ


๐Ÿซง DIAGNOSTICS

if /dev/random isn't available, apg will show a message about it ๐Ÿ™ˆ


๐Ÿ“ FILES

None. ๐Ÿฆ‹


๐Ÿ› BUGS

None. if you find one, send a bug description to the author ๐Ÿ’Œ


๐Ÿ”— SEE ALSO

apgd(8), apgbfm(1) ๐ŸŒˆ


๐ŸŒŸ AUTHOR

Adel I. Mirzazhanov, <a-del@iname.com> project home page: http://www.adel.nursat.kz/apg/ ๐Ÿ’–


Automated Password Generator, 2003 Aug 04, APG(1) โ€” bestie, that's a wrap! โœจ slay the password game forever ๐Ÿ’…๐ŸŽ€๐Ÿฆ‹

๐Ÿ“ฆ where this page comes from