#example
$1$12345678$zzzzzzzzzzzzzzzzzzzzzz
#decribe
12345678 加密用的8位數key值
$1$12345678$zzzzzzzzzzzzzzzzzzzzzz 加密完後的資料
#perl example
#!/usr/bin/perl
use Crypt::PasswdMD5 qw(unix_md5_crypt);
$user = shift;
$pass = shift;
$line = `cat /etc/shadow | grep $user`;
@shadow = split(/:/,$line);
$passwd_unix = $shadow[1];
$key = substr($passwd_unix,3,8),"\n";
$passwd_perl = unix_md5_crypt($pass,$key),"\n";
print 'passwd_unix = ',$passwd_unix,"\n";
print 'passwd_perl = ',$passwd_perl,"\n";
全站熱搜
留言列表