OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
From: Adrian Zurek (adekone.pl.eu.org)
Date: Wed Apr 18 2001 - 11:43:22 CDT

  • Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

    On Wed, Apr 18, 2001 at 03:33:30PM +0200, Diego Zaccariotto wrote:
    > To create the encrypted password you can use the following perl script,
    > just use ./script login cleartextpassword:
    >
    > #!/usr/bin/perl
    <snip>
    > $salt = '$1$';
    > salt2 = (a...z,A...Z,0...9);
    > $salt .= $salt2[rand(62)].$salt2[rand(62)].$salt2[rand(62)].$salt2[rand(62)].$salt2[rand(62)].$salt2[rand(62)].$salt2[rand(62)].$salt2[rand(62)];
    >
    > print "$username:",crypt($passwd, $salt), "\n";
    Ehm, I'd better use something like this:

    #!/usr/bin/perl

    do {
            print "Passwords do not match!\n\n" if (defined $salt);
                    
            $salt = join '', ('.', '/', 0..9, 'A'..'Z', 'a'..'z')[rand 64, rand 64];

            system "stty -echo";

            print "Password: ";
            chomp ($pwd = <STDIN>);
            $crypted = crypt($pwd, $salt);
            $pwd = "x" x 100;

            print "\nRetype password: ";
            chomp ($pwd = <STDIN>);
            $crypted2 = crypt($pwd, $salt);
            $pwd = "x" x 100;
            
            system "stty echo";
            print "\n";
    }
    while ($crypted ne $crypted2);

    print "Encrypted password: $crypted\n";

    -- 
           _________         ___.  ____               adrian zurek
       ____\        \ _______-- !_/   /            adekone.pl.eu.org
      /     \   \   \\ _____/        /-------------------------------------------.
      \  --  \   \   / ___)____     <     18:42:26 up 7 days, 15:33,  2 users    |
       \____/\\_____/_______  /     \\       load average: 1.00, 1.03, 1.00      |
     `--------\/---guru----\/__/\____\------------------------------------------'
    

    - To unsubscribe, send mail to majordomopostfix.org with content (not subject): unsubscribe postfix-users