randpass - generate random passwords and passphrases
randpass [ -w | -p NUMWORDS ] [ -s WORDSOURCE ] [ -l WORDLEN ]
randpass generates random passwords and passphrases to your specifications.
Generate passwords (the default).
Generate passphrases with the specified number of words. The passphrase that is generated will not contain duplicate words (e.g., urial hayseed dumpish urial). This may not be a range.
urial hayseed dumpish urial
When this option is used, options -c and -C are ignored.
Generate the specified number of passwords or passphrases. This may not be a range.
The length of the password, or of each word in the passphrase.
If a range is specified (e.g., --word-length 8-14) then the length of the password (or of the words in the passphrase) will fall randomly within that range (including both endpoints). Half-open ranges (e.g., --word-length 3-) are not allowed.
--word-length 8-14
--word-length 3-
The default is 7-14 for passwords and 4-7 for passphrases.
The set of characters (specified as a sequence of characters) used in generating a password. This is currently ignored if passphrases are being generated.
You may specify a named set instead. Choose among these...
('A'..'H', 'J'..'N', 'P'..'Z', ('a'..'k', 'm', 'n', 'p'..'z') x 2, '2'..'9')
This is the default. It omits digits and letters that may be mistaken for each other (l, I, 1; o, O, 0).
l
I
1
o
O
0
('A'..'Z', 'a'..'z')
('a'..'z')
('A'..'Z')
('A'..'Z', 'a'..'z', '0'..'9')
('0'..'9')
Hexadecimal digits (lowercase).
('0'..'9', 'a'..'f')
Hexadecimal digits (uppercase).
('0'..'9', 'A'..'F')
Binary digits.
(0, 1)
Binary data (bytes 0 through 255).
("\x00".."\xFF")
Binary data (bytes 0 through 127).
("\x00".."\x7F")
Repeated use of this option is cumulative, so (for example) the following will generate passwords that may be expected to contain (on average) twice as many upper-case letters as lower-case letters:
randpass -c :upper -c :upper -c :lower
Specify a range of (ASCII) characters to use. As is true of -c, use of multiple -C options is cumulative.
Options -c and -C may be freely interspersed, and the order in which they are given is not significant, so the following are all equivalent:
randpass -c :upper -c :lower -c :num randpass -C a-z -C 0-9 -C A-Z randpass -c :num -c :upper -C a-z
Specifies that all generated passwords (not passphrases) must have at least num (default 1) occurrences of the characters specified by string-or-setname, which may be a named set (e.g., :alphanum) or a string of required characters (e.g., aeiou).
:alphanum
aeiou
For example, the following will generate passwords with at least 2 digits and at least 1 of the given punctuation marks:
randpass -c :alphanum -c '!@%' -r '2#:num' -r '!@%'
Any required characters must be specified in a -c or -C option.
The maximum number of passwords that may be rejected (default 5,000). If this is exceeded, an error will result.
Specify the source file from which words will be drawn in generating a passphrase. This file will typically consist of a single word per line (but creative uses of randpass may do otherwise for interesting results).
randpass
The default is /usr/share/dict/words. The special file name - may be used to specify standard input.
/usr/share/dict/words
-
Note: If the source file doesn't have enough lines (of sufficient length) to generate the full passphrase, the program exits with code 1 and prints a suitable error message to standard error.
Use the FRELI word list (/usr/share/dict/freli when generating passphrases. (See http://www.nkuitse.com/freli/ for more information about FRELI.)
/usr/share/dict/freli
When generating a passphrase, connect the words with the specified string rather than a space.
Uses the author's favorite options by default (-p 2 -l 3-5) and adds the option -s /usr/share/dict/freli if there is a file at that location.
-p 2 -l 3-5
-s /usr/share/dict/freli
Display version information.
Display help.
Paul Hoffman ( nkuitse AT cpan DOT org )
Copyright 2003-2008 Paul M. Hoffman.
This script is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install randpass, copy and paste the appropriate command in to your terminal.
cpanm
cpanm randpass
CPAN shell
perl -MCPAN -e shell install randpass
For more information on module installation, please visit the detailed CPAN module installation guide.