Here is a little script I wrote to help me generate passwords. It's a PERL script, and it generates 20 passwords as it is, although that can change easily enough. I have it written to generate 15 character passwords, with a minimum of the following: 2 numbers, 2 upper case letters, 2 special characters, 2 lower case letters. This ends up being some pretty touch cookies to contend with, but they get the job done. I like generating 20 because I can looks over the list and pick one that looks good to me. So, without further pedantic ramble on my part, here it is:
#!/usr/bin/perl
@uc=split(/,/,"A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z");
@lc=split(/,/,"a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z");
@sc=split(/,/,"~,!,@,#,%,^,&,*,-,.,:");
sub rn() {
$l=$_[0];
$u=$_[1];
$random = int(rand( $u-$l+1 ) ) + $l;
return $random;
}
sub genpass() {
my $uccnt=0;
my $lccnt=0;
my $sccnt=0;
my $nmcnt=0;
my $tpw="";
$pwlen=0;
while ($pwlen < 15) {
$op = &rn(1,4);
if ($op == 1) {
if ($uccnt < 4) {
$x = &rn(0,25);
$tpw = $tpw . $uc[$x];
$uccnt++;
}
} elsif ($op == 2) {
if ($lccnt < 5) {
$x = &rn(0,25);
$tpw = $tpw . $lc[$x];
$lccnt++;
}
} elsif ($op == 3) {
if ($sccnt < 2) {
$x = &rn(0,10);
$tpw = $tpw . $sc[$x];
$sccnt++;
}
} elsif ($op == 4) {
if ($nmcnt < 4) {
$x = &rn(1,9);
$tpw = $tpw . $x;
$nmcnt++;
}
}
$pwlen = length($tpw);
}
return $tpw;
}
print "\n";
for ($a=1;$a<21;$a++) {
$pw = &genpass();
print "$a)\t$pw\n";
}
print "\n";
Enjoy!