Password Generator

[BB] Rick James

[H]ard Dawg
Joined
Apr 4, 2004
Messages
2,810
Anyone know of a password generator that will create passwords based on a scheme that I could specify? For example, lets say I wanted all passwords generated to have a 3, 2, 3 scheme, meaning 3 letters, 2 numbers and 3 letters. (abc12efg)

Any generators out there for this? I can't seem to find one that will works like this.
 
I can write one that will do that in about 2 minutes, if you have Perl installed. Let me whip one up and I'll reply with it.
 
I can write one that will do that in about 2 minutes, if you have Perl installed. Let me whip one up and I'll reply with it.

I don't have perl installed but I'm sure I can get it installed. That would be great if you could write one.
 
*NOTE* Having passwords based upon a pattern is a BAD idea, as it limits your keyspace

It ain't pretty, but it works...

bwindle@RTIX-NM-003:~/perl$ perl rickjamespwd.pl
RQH63lyK
bwindle@RTIX-NM-003:~/perl$ perl rickjamespwd.pl
Jwf01avq
bwindle@RTIX-NM-003:~/perl$ perl rickjamespwd.pl
Dfq40OBr
bwindle@RTIX-NM-003:~/perl$ perl rickjamespwd.pl
Yus61kfa
bwindle@RTIX-NM-003:~/perl$ perl rickjamespwd.pl
aMc17KLh
bwindle@RTIX-NM-003:~/perl$ perl rickjamespwd.pl
aab15SRX
bwindle@RTIX-NM-003:~/perl$ perl rickjamespwd.pl
MqL93Wtp
bwindle@RTIX-NM-003:~/perl$ perl rickjamespwd.pl
QKf05rWN

Code is:
Code:
#!/usr/bin/perl -w
#
# lame little script to generate semi-random passwords with the specified pattern
#

@a=('A'..'Z', 'a'..'z');
@num=(0 .. 9);

$set1=0;
while ($set1 < 3) {
$arand=int(rand(52));
print "$a[$arand]";
$set1++;
}

$set2=0;
while ($set2 < 2) {
$nrand=int(rand(10));
print "$num[$nrand]";
$set2++
}

$set3=0;
while ($set3 < 3) {
$arand=int(rand(52));
print "$a[$arand]";
$set3++;
}

print "\n";
 
If you have letters (upper and lower) and numbers, and 8 characters in length, that yields 62^8 possible combinations (218,340,105,584,896). By following your pattern (assuming the attacker knows the pattern) you reduce your possible keyspace to 52*52*52*10*10*52*52*52, or 1,977,060,966,400. That's a HUGE difference (110 times as small). Keep that in mind. If you toss in some symbols/punctuation, it makes about 6,095,689,385,410,820 possible combinations (94^8).
 
If you don't/can't get Perl, here is a PHP version.

Code:
<?php

$lower=range('a','z');
$upper=range('A','Z');
$a=array_merge($lower,$upper);

$set1=0;
while ($set1 < 3) {
$arand=rand(1, 52);
print "$a[$arand]";
$set1++;
}

$set2=0;
while ($set2 < 2) {
$nrand=rand(0, 9);
print "$nrand";
$set2++;
}

$set3=0;
while ($set3 < 3) {
$arand=rand(1, 52);
print "$a[$arand]";
$set3++;
}

print "\n";


?>
 
Back
Top