#!/usr/bin/perl # # Name: Matthew Reeves # # Perl program to build a fake shadow file to test dictionary attacks # use warnings; use strict; use feature ":5.10"; use Digest::MD5 qw(md5_hex); open(SHADOW, " ) { $_ =~ /(\w*):(\w*)/; push (@username, $1); push (@password, $2); } close SHADOW; foreach my $pass (@password) { $password[$count] = md5_hex($password[$count]); $count++; } open(SHADOW, ">", "shadow"); while ( $tmp < $count ) { say SHADOW "$username[$tmp]:$password[$tmp]"; $tmp++; } close SHADOW;