LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Want an easy password generator? Try this :) (https://www.linuxquestions.org/questions/linux-general-1/want-an-easy-password-generator-try-this-345511/)

taskara 07-21-2005 05:12 PM

Want an easy password generator? Try genpass :)
 
Greetings,

My friend Matthew Oliver and I have worked on a GPL password generator script that creates decent random passwords for Linux users (genpass - the random password generator).

If you would like to check it out, you can download the tarball here, and extract where you like (prob /usr/local/bin).

Or, if you're a Gentoo user we have an ebuild here.

Simply extract to your portage overlay (default is /usr/local/portage, but I use /usr/portage/local).
Code:

tar -zxvf genpass-0.3-ebuild.tar.gz -C /usr/local/portage
and unmask it
Code:

echo "sys-apps/genpass ~x86 >> /etc/portage/package.keywords"
(substitute ~x86 for your arch, ie ~amd64)

Then emerge it :)
Code:

emerge -av genpass
once you have it, run
Code:

genpass --help
and you should get
Code:

chris@josiah ~ $ genpass --help
Usage: genpass [-L <number>] [-n <number>] [-a <number>] [-u <number>] [-l <number] [-s <number>]

Generates a random password
-L, --length    Specifies the length of the password.
                Default = 8
-n, --number    Specifies the number of number characters in the password.
                Default = 0 *
-a, --ascii    Specifies the number of ascii characters in the password.
                Default = 0 *
-u, --upper    Specifies the number of uppercase characters in the password.
                Default = 0 *
-l, --lower    Specifies the number of lowercase characters in the password.
                Default = 0 *
-s, --space    Specifies the number of space characters in the password.
                Default = -1 *

*: (-1 = none, 0 = any, >0 = at least the specified number)

enjoy!

There are probably other easier ways to do this, but it was fun and we hope else someone finds it useful :cool:

Let us know your thoughts.

Cheers,
Chris & Matt

rodeoclown 07-22-2005 06:24 AM

Or if you have perl installed, which I think every Linux distro comes with you can use the String::Random module to do this with about 3 lines of code....

http://www.mathematik.uni-ulm.de/hel...ng/Random.html

;)

taskara 07-23-2005 06:53 AM

that's pretty cool :)

still it was fun to make ;)

I guess you could think of genpass as the perl random_string module for bash :D
imagine how much code there is behind the random_string module.
And for people who don't know how to use the "complex" perl commands, genpass makes it easy.

Not to mention, with genpass you can do it in one line! :P hehe

And not that anyone seems interested, but version 0.2 is out

cheers

rodeoclown 07-24-2005 04:58 PM

Quote:

Originally posted by taskara
that's pretty cool :)

still it was fun to make ;)

I guess you could think of genpass as the perl random_string module for bash :D
imagine how much code there is behind the random_string module.
And for people who don't know how to use the "complex" perl commands, genpass makes it easy.

Not to mention, with genpass you can do it in one line! :P hehe

And not that anyone seems interested, but version 0.2 is out

cheers

Well the module is only 492 lines long but since its a module, the actual code of the perl script would be:

Code:

  use String::Random;
  $pass = new String::Random;
  print "Your password is ", $pass->randpattern("CCcc!ccn"), "\n";

3 total lines for your perl script to generate your random string password.. which then you would customize and probably only end up being a few more lines longer.. then the actual perl script would run just like your bash script, from the command line, so it would also be done from one line.. ;)

taskara 07-24-2005 11:02 PM

oh well, perhaps it's a useless little tool

but version 0.3 is out

and I like it :)

cheers


All times are GMT -5. The time now is 01:52 PM.