This is a small script written in PHP which will help you to generate N passwords of N length in less than 1ms 😛
Make sure you have PHP installed, then copy this code to a file called randompass.php
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
#!/usr/bin/php -q <? // no i,l,o keep passwords easy $chars = "abcdefghjkmnpqrstuvwxyz0123456789"; $passlen = (intval($argv[1])? intval($argv[1]):6); $passnum = (intval($argv[2])? intval($argv[2]):1); echo "Generating $passnum passwords of $passlen letters/numbers\n"; // feed the random God :P srand(((int)((double)microtime()*1000003))); for ($i=1;$i<=$passnum;$i++) _gen_pass(); function _gen_pass() { global $chars, $passlen; $cnt = 1; while ($cnt <= $passlen) { $myrand = rand() % 33; $tmp = substr($chars, $myrand, 1); if (rand(0,1)) $tmp = strtoupper($tmp); $pass = $pass . $tmp; $cnt++; } echo $pass . "\n"; } ?> |
Now you have the file don’t forget to make it executable:
1 |
chmod +x randompass.php |
How it works? See some examples:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
Usage: ./randompass.php [password_length] [password_number] # The default execution will drop 1 password of 6 letters/numbers ./randompass.php Generating 1 passwords of 6 letters/numbers 9hBEq1 # want 5 passwords of 12 letters/numbers ? ./randompass.php 12 5 Generating 5 passwords of 12 letters/numbers ug5Tj8fP3w26 Tn9fnSjy2PmJ NRqC6m8J0svn YFQ6g3WnHH8r ds56SnQvsBEq |
That’s all, use it for what you need, don’t try to break it or find stupid bugs 😛