2012-09-04 13:32:24 +00:00
|
|
|
#!/usr/bin/perl
|
|
|
|
|
|
|
|
# This program generates passwords that:
|
|
|
|
#
|
|
|
|
# * are hard to guess
|
|
|
|
# * will be displayed unambigously in any (normal) font
|
|
|
|
# * will survive being passed through a bad fax machine
|
2014-09-18 12:15:00 +00:00
|
|
|
# * will survive being passed through handwriting
|
2012-09-04 13:32:24 +00:00
|
|
|
# * has UPPER lower number and sign
|
|
|
|
#
|
2014-09-18 12:15:00 +00:00
|
|
|
# Too close: B8 cC g9 6G kK lI l1 oO O0 pP sS uU vV xX zZ Z2 ,. :; `' S5
|
2012-09-04 13:32:24 +00:00
|
|
|
# Causes problems in URLs: @/:
|
2013-02-08 08:43:05 +00:00
|
|
|
# Causes problems in shell: ! " # $ & ( ) [ ] { } ? | < > \ * =
|
2012-09-04 13:32:24 +00:00
|
|
|
# SQL uses: % for wildcard
|
|
|
|
# Hard to type: ^ ~ ¨ ¤ § ½ æ ø å Æ Ø Å
|
|
|
|
# Never 2 same chars next to eachother. (--) is bad
|
2014-09-18 12:15:00 +00:00
|
|
|
# Do not start with '-' or '+' as that looks like an (long) option
|
2014-04-26 09:02:32 +00:00
|
|
|
#
|
|
|
|
# US-kbd: ~!@#$%^&*()_+ [] {} ;'\ :"| < > ,./ <>?
|
|
|
|
# DK-kbd: §!"#¤%&/()=?` å" Å^ æø' ÆØ* < > ,.- ;:_
|
|
|
|
# Common: ! # % < > ,.
|
2012-09-04 13:32:24 +00:00
|
|
|
|
|
|
|
my $pw;
|
2014-09-18 12:15:00 +00:00
|
|
|
my @chars=split //, 'abdefhijmnqrtyADEFHJLMNQRTY347+-';
|
2012-09-04 13:32:24 +00:00
|
|
|
do {
|
|
|
|
$pw = "";
|
|
|
|
for (1..12) {
|
2014-09-18 12:15:00 +00:00
|
|
|
$pw .= $chars[rand $#chars+1]
|
2012-09-04 13:32:24 +00:00
|
|
|
}
|
2014-09-18 12:15:00 +00:00
|
|
|
} while (($pw =~ /^[+-]/ or $pw =~ /(.)\1/) or
|
|
|
|
not($pw =~ /[A-Z]/ and
|
2012-09-04 13:32:24 +00:00
|
|
|
$pw =~ /[a-z]/ and
|
|
|
|
$pw =~ /[0-9]/ and
|
|
|
|
$pw =~ /[^a-zA-Z0-9]/));
|
|
|
|
|
|
|
|
print "$pw\n";
|