#!/usr/bin/perl # MD5/SHA1 dictionary attack # By Feky # use Digest::MD5 qw(md5_hex); use Digest::SHA1 qw(sha1_hex); use warnings; if(@ARGV != 2){ print "Usage: $0 [hash] [file]\n"; exit 1; } open(FILE, $ARGV[1]) or die "Can't open file.\n" and exit 1; if(length($ARGV[0]) == 32){ print "Hash type is MD5\nComparing...\n"; while(){ if($ARGV[0] =~ md5_hex($_)){ print "Hash found.\n$ARGV[0] = $_\n"; exit 1; } } } elsif(length($ARGV[0]) == 40){ print "Hash type is SHA1\nComparing...\n"; while(){ if($ARGV[0] =~ sha1_hex($_)){ print "Hash found.\n$ARGV[0] = $_\n"; exit 1; } } } else { print "Invalid hash format.\n"; exit 1; } print "Hash not found. Kill yourself.\n"; exit;