Just a pretty cool password generator I made to generate passwords for my site after it got bruteforced.
It generates 9 character, alpha-numerical, upper and lower case passwords.
Just something I thought others would appreciate.
Here is a list of passwords generated with it.
93q996U45
K64j14sek
3G2QX15Q7
9194221S4
TYM8lfA67
j13c4l4MB
y22iMg7t7
I23EeaS33
577729391
Rh42LomYr
467359628
f4MLZJ858
8291Gr6RP
42S6H44r7
966i49T4y
42hZ4lR81
2ij633W39
561hpSJ14
Much better than my first one which used about 50 if statements and was all lower case. Or my second one which only allowed for a set amount of characters.
Enjoy.
Redid it so you can /passgen [x] where x = the amount of characters you want in the password. If x is not supplied, the default of 9 is used.
alias passgen {
var %chars 1
if (!$1) {
var %amount = 9
}
if ($1) {
var %amount = $1
}
while (%chars <= %amount) {
var %watsit = $rand(1,2)
if (%watsit == 1) {
var %pass %pass $rand(1,9)
}
if (%watsit == 2) {
var %upordown = $rand(1,2)
if (%upordown == 1) {
var %pass %pass $rand(a,z)
}
if (%upordown == 2) {
var %pass %pass $upper($rand(a,z))
}
}
inc %chars
}
echo -a 14[ $+ $asctime(HH:nn) $+ ]7 $remove(%pass,$chr(32))
}
Sloth
NO, I win! Mine goes to 4144 characters!
alias passgen {
var %r
while $len(%r) < $1 {
%r = %r $+ $chr($remove($r(48,122),58,59,60,61,62,63,64,91,92,93,94,95,96))
}
return %r
}
However, I like Thelmac's best but to be perfectly 'fair' his should be like this:
alias genpass { return $eval($ $+ +( $str($!iif($floor($calc($r(0,61)/10)),$iif($r(0,1),$r(A,Z),$r(a,z)),$r(0,9)) $+ $chr(44),$1) ),2) }
This way is a close enough approximation:
alias genpass { return $eval($ $+ +( $str($!iif($r(0,5),$iif($r(0,1),$r(A,Z),$r(a,z)),$r(0,9)) $+ $chr(44),$1) ),2) }
His original version produces about 50% numbers in the string.
Also, Thelmac if you need a password 469 characters you can:
$str($genpass(67),7)
alias PWgen $left($str($genpass(79),52), $1)
To produce up to 4108 character passwords.
=) If I am in need of a 469 character password, I will be using your snippet. I see you changed your snippet, I was going to suggest doing exactly what you did with %pass %pass and removing the spaces, nice job!
edit: also you can do
var %amount = $iif($1 isnum,$1,9)
edit edit:
And if you want you can even use
while (%amount) { dec %amount }
heh sorry, just bored and like to make things more efficient =)