Try using the Shell package.
use Shell;
I was required to do NIS password authentication in my webpage, and here is the script that I used to figure it out.
#!/bin/perl -w
use strict;
use diagnostics;
use Shell;
print "Enter your username: ";
my $USER = <STDIN>;
chop ($USER);
print "Password: ";
my $PASS = <STDIN>;
chop($PASS);
# ypmatch is a linux shell command.
my $str = ypmatch("$USER", "passwd");
chop($str);
my @Tmp = split(":", $str);
my $Tr = $Tmp[1];
my $salt = substr($Tr, 0, 2);
my $ENCPASS = crypt($PASS,$salt);
print "-------------------------------------------------\n";
print "String from yp: $str\n";
print "Transformed to: $Tr\n";
print "Salt for pass: $salt\n";
print "Your encrypted Password: $ENCPASS\n";
print "Password from ypcat: $Tr\n";
Now mind you, this was only a test. I certainly don't do any code that willy-nilly displays a person's password to the word.
Kristofer Hoch. |