www.flickr.com
tres frijoles' photos More of tres frijoles' photos
You are here: tearsoffire.org > Projects Web > LinuxProjects > RandPass r1 - 03 Oct 2006 - 10:43 - ChristopherPepe


Start of topic | Skip to actions

RandPass

about

This is a simple script that uses perl's rand() function and a pseudo-random array to generate a password of arbitrary length. I wrote it when I was the admin of Jira since we assigned new users random 6 char passwords. I usually have to run the script a few times to find a password that I like.

cmd args

Given no args the scripts spits out a password of length 6. Given one argument N, the script spits out a password of lengeth N.

source

#!/usr/bin/perl 

my @charsList = qw(q 1 ! l z 7 x 4 3 2 s 9 r e 5 2 c v D F @ G H J w 2 Q W E u R T Y U I O e 3 # r 4 $ t 5 % y 6 u 7 & i 8 * o 9 - p 0 + b n 5 m P * A S a ~ s . d f g [ h ] j { k } K L 1 Z 4 5 X C $ V B % N M);

#set password length on CL
($len = shift)||($len=6); #@argv

print "Low Quality Random Password Generator v0.1\n";
print "\n##################################\n";
my $a = @charsList;
print "choosing from $a characters\n";
print "your $len char random string is:\n";

for($x=0; $x<$len; $x++)
{
	print "$charsList[rand(@charsList)]";
}
print "\n##################################\n";
print "\n\n";

-- ChristopherPepe - 03 Oct 2006

Edit | Attach | Printable | Raw View | Backlinks: Web, All Webs | History: r1 | More topic actions
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding tearsoffire.org? Send feedback