Generate a random password with some parameters. Developed on MacOS X, but theoretically platform-independant. Download mkpasswd-2009Dec19.tar.gz or mkpasswd.py.
Example usage ($
is the command prompt):
$ mkpasswd.py
?!_:cuMW
$ mkpasswd.py -n 10 -u 1 -l 1 -d 2 -p 0
7uBm9H6NQm
$ mkpasswd.py -n 6 -e \"\| -d .2 -p .2
LwVa+b
$ mkpasswd.py --help
Usage: mkpasswd.py [options]
Options:
-h, --help show this help message and exit
-n NUMCHARS, --numchars=NUMCHARS
number of characters in the desired password
-e EXCLUDESTRING, --exclude=EXCLUDESTRING
exclude characters found in EXCLUDESTRING
-l LOWER, --lowercase-weight=LOWER
relative weighting for characters in the lowercase set
-u UPPER, --uppercase-weight=UPPER
relative weighting for characters in the uppercase set
-d DIGIT, --digit-weight=DIGIT
relative weighting for characters in the digit set
-p PUNCT, --punctuation-weight=PUNCT
relative weighting for characters in the punctuation
set
I use this (frequently) to generate random passwords for sites I only expect to log in to once (or, once every six months).
I have, in my .profile
:
alias mkpasswd='/path/to/mkpasswd.py -p .5'
Weighting is relative to a category's default, as opposed to relative to other categories. For example, there are 26 lowercase letters, and 36 punctuation characters, so default weighting produces more punctuation than lowercase letters. By contrast, mkpasswd.py -p .5
makes it as though there were only 16 punctuation characters, so punctuation is roughly two-thirds as likely as lowercase letters.
Invented independently from, but very similar to, NIST's / Don Libes' mkpasswd.
Up for licensing.
2009-12-19 / Python Script / 1 file, 79 lines, 2.2K
In: Code
Created by and © 2009 Mark Fickett except where noted. I try for valid XHTML 1.0 Strict and CSS.