#!/usr/local/bin/perl
#############################################################################
# #
# File: shadmrg #
# #
# Usage: called from crack (shadmrg) #
# #
# Version: 1.00 #
# #
# Description: #
# Used to hack/patch crack to run on a trusted UNIX system. Replace #
# the existing {$crack_home}/Scripts/shadmrg with this file to #
# create a temporary password file, including passwords for crack #
# to work on. #
# #
# Author: Michael A. Gumienny 08-Aug-1996 #
# #
#############################################################################
$PasswordFile="/etc/passwd";
$TrustedDir="/tcb/files/auth";
# Ignore pw_id_map under system...
open(PASSWORDS, "<$PasswordFile");
while()
{
chop;
($User, $b, $c, $d, $e, $f, $g)=split(":", $_);
($FirstChar)=split("", $_);
open(PASSWD, "<$TrustedDir/$FirstChar/$User") || die "Can't open $TrustedDir/$FirstChar/$User";
while()
{
next unless ($_ =~ "u_pwd");
($x,$Pass)=split("=", $_);
chop($Pass); chop($Pass); chop($Pass);
#print $Pass;
}
close(PASSWD);
printf("%s\n", join(":", $User, $Pass, $c, $d, $e, $f, $g));
}
close(PASSWORDS);