in reply to Passwords on unix
#!/usr/bin/perl #Check password encryption $username = shift || die "Usage $0 username plaintext_password\n"; $plaintext = shift || die "Usage $0 username plaintext_password\n"; $encpass = (getpwnam($username))[1]; print "Testing encryption ... "; if (crypt($plaintext, $encpass) ne $encpass) { print "FAILED\nTrying MD5 encryption ... "; if ( eval "use Crypt::PasswdMD5" ) { print "FAILED\n\nCannot try MD5 since Crypt::PasswdMD5 is not inst +alled.\n"; } else { if (&unix_md5_crypt($plaintext, $encpass) ne $encpass) { print "FAILED\n\nUnable to automatically use passwords from your + system.\n"; } else { print "OK\n\nMD5 passwords were detected.\n"; } } } else { print "OK\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Passwords on unix
by Abigail-II (Bishop) on Feb 04, 2003 at 20:39 UTC | |
by fokat (Deacon) on Feb 04, 2003 at 21:54 UTC |