Hello
I just changed wwwacct so it generates random hard-to-guess passwords automatically when you try to create an account without supplying a password.
As I could see, cPanel already had this option (or something similar to that, but I didn't get how to use it, nor found in documentation).
So, just below $pass = $ARGV[2];
you have
if ($pass =~ /^fd:/) {
between these lines, add:
my($lem0n_length) = 8;
this is the length of the password
if you want a random length, you can use, for example:
my($lem0n_length) = 8 + int(rand(7));
this will generate a random length from 8 to 14 (because rand(7) generate a number from 0 to 6)
in the end of $lem0n_possible lines you see "x [number]"
this [number] is the relative probability of, in order, lowercase, uppercase and numbers happening on the password
in this case the [numbers] are 2, 2 and 1. So the probability is that the password has, for each 5 characteres: 2 lowercase, 2 uppercase letters and 1 number
of course that's just a probability, so you can have, for example, a password just with lowercases
well... i think that's all
if someone knows another way of creating random passwords easily, please let me know
-- Luis Fernando Estrozi
I just changed wwwacct so it generates random hard-to-guess passwords automatically when you try to create an account without supplying a password.
As I could see, cPanel already had this option (or something similar to that, but I didn't get how to use it, nor found in documentation).
So, just below $pass = $ARGV[2];
you have
if ($pass =~ /^fd:/) {
between these lines, add:
if ($pass =~ /^fd:/) {
my($lem0n_possible);
my($lem0n_length) = 8;
$pass="";
for($j=0; $j<$lem0n_length; $j++) {
$lem0n_possible = chr(ord('a') + int(rand(25))) x 2;
$lem0n_possible .= chr(ord('A') + int(rand(25))) x 2;
$lem0n_possible .= chr(ord('0') + int(rand(9))) x 1;
$pass .= substr($lem0n_possible, rand(length($lem0n_possible)), 1);
}
}
my($lem0n_length) = 8;
this is the length of the password
if you want a random length, you can use, for example:
my($lem0n_length) = 8 + int(rand(7));
this will generate a random length from 8 to 14 (because rand(7) generate a number from 0 to 6)
in the end of $lem0n_possible lines you see "x [number]"
this [number] is the relative probability of, in order, lowercase, uppercase and numbers happening on the password
in this case the [numbers] are 2, 2 and 1. So the probability is that the password has, for each 5 characteres: 2 lowercase, 2 uppercase letters and 1 number
of course that's just a probability, so you can have, for example, a password just with lowercases
well... i think that's all
if someone knows another way of creating random passwords easily, please let me know
-- Luis Fernando Estrozi