[plug] Passwords

Steve Grasso steveg at calm.wa.gov.au
Mon Mar 11 09:51:19 WST 2002


Perhaps not half a line, but this uses a better salt:

#!/usr/bin/perl
@range = ('0'..'9','a'..'z','A'..'Z');
srand;
$salt = $range[rand(int($#range)+1)] . $range[rand(int($#range)+1)];
$passwd = crypt("", $salt);
print "Empty crypted password: $passwd\n";

Regards,
Steve 
ONNAPH (Oh No Not Another Perl Hacker)

On Saturday 09 March 2002 23:22, Russell Steicke wrote:
> On Sat, Mar 09, 2002 at 10:57:03PM +0800, Adrian Woodley wrote:
> > I had a look at /etc/shadow on my first attempt, but couldn't work out
> > what to put in the password field. Any suggestions?
>
> Originally I thought an empty field would do it, but no.  So this
> whipped-up C program will MD5-encrypt an empty string.  Cut and paste
> that string in to /etc/shadow.  I just tried it, and it works.  You may
> want to replace "abcdefgh" in the salt parameter to something less
> obvious.  See crypt(3).
>
> This could probably be done in half a line of perl. :)
>
>
>
> #include <stdio.h>
> #include <crypt.h>
>
> int main()
> {
>         printf("Empty crypted password: \"%s\"\n",
>                         crypt("", "$1$abcdefgh"));
> }



More information about the plug mailing list