Simple script para crackear un hash MD5 mediante un diccionario.
#!usr/bin/perl
#MD5 Crack 0.2
#Coded By Doddy H
#Test with
#098f6bcd4621d373cade4e832627b4f6 : test
#cc03e747a6afbbcbf8be7668acfebee5 : test.123
#1943b8b39ca8df2919faff021e0aca98 : testar
#177dac170d586383bcc889602b2bb788 : testar.123
use Digest::MD5 qw(md5_hex);
head();
while (1) {
print qq(
[++] Options
[+] 1 : Crack hash
[+] 2 : Crack hashes
);
print "\n[+] Option : ";
chomp( my $op = <stdin> );
if ( $op eq "1" ) {
print "\n[+] MD5 : ";
chomp( my $md5 = <stdin> );
print "\n[+] Salt : ";
chomp( my $salt = <stdin> );
print "\n[+] Wordlist : ";
chomp( my $wordlist = <stdin> );
crackhash( $md5, $salt, $wordlist );
}
elsif ( $op eq "2" ) {
print "\n[+] File : ";
chomp( my $md5 = <stdin> );
print "\n[+] Salt : ";
chomp( my $salt = <stdin> );
print "\n[+] Wordlist : ";
chomp( my $wordlist = <stdin> );
crackhashes( $md5, $salt, $wordlist );
}
else {
print "\n\n[-] Bad option\n";
}
}
copyright();
sub crackhashes {
my ( $file, $salt, $wordlist ) = @_;
my @hashes = openwordlist($file);
my $formar;
for my $md5 (@hashes) {
chomp $md5;
my $formar = $md5;
if ( ver_length($md5) ) {
my @words = openwordlist($wordlist);
print "[+] Cracking ....\n\n";
for my $word (@words) {
chomp $word;
my $formardos;
if ( $salt eq "" ) {
$formardos = md5_hex($word);
}
else {
$formardos = md5_hex( $word . $salt );
}
if ( $formar eq $formardos ) {
print "\n\a[+] Cracked : " . $formar . ":" . $word . "\n";
savefile( "md5-found.txt", $formar . ":" . $word );
last;
}
else {
print $formar. " =! " . $formardos . "\n";
}
}
}
else {
print "\n[-] Hash invalid";
last;
}
}
}
sub crackhash {
my ( $md5, $salt, $wordlist ) = @_;
my $formar = $md5;
if ( ver_length($md5) ) {
my @words = openwordlist($wordlist);
print "[+] Cracking ....\n\n";
for my $word (@words) {
chomp $word;
my $formardos;
if ( $salt eq "" ) {
$formardos = md5_hex($word);
}
else {
$formardos = md5_hex( $word . $salt );
}
if ( $formar eq $formardos ) {
print "\n\a[+] Cracked : " . $formar . ":" . $word . "\n";
savefile( "md5-found.txt", $formar . ":" . $word );
copyright();
}
else {
print $formar. " =! " . $formardos . "\n";
}
}
}
else {
print "\n[-] Hash invalid";
}
}
sub ver_length {
return true if length( $_[0] ) == 32;
}
sub openwordlist {
my ( $file, $tipo ) = @_;
print "\n[+] Opening file\n\n";
unless ( -f $file ) {
print "\n[-] File not found\n";
copyright();
}
open( FILE, $file );
my @words = <FILE>;
close FILE;
print "[+] Words Found : " . int(@words) . "\n\n";
return @words;
}
sub repes {
my @limpio;
foreach $test (@_) {
push @limpio, $test unless $repe{$test}++;
}
return @limpio;
}
sub savefile {
open( SAVE, ">>" . $_[0] );
print SAVE $_[1] . "\n";
close SAVE;
}
sub head {
print qq(
@ @ @@@@ @@@@@ @@@@ @@@@@ @ @@@@ @ @
@ @ @ @ @ @ @ @ @ @ @ @ @ @
@@ @@ @ @ @ @ @ @ @ @ @ @ @
@@ @@ @ @ @@@@ @ @ @ @ @ @ @@
@ @ @ @ @ @ @ @ @ @@@@@ @ @ @ @@
@ @ @ @ @ @ @ @ @ @ @ @ @ @ @
@ @ @ @ @ @ @ @ @ @@@@@ @ @ @
@ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @
@ @ @@@@ @@@ @@@@ @ @ @ @ @@@@ @ @
);
}
sub copyright {
print "\n\n-- == (C) Doddy Hackman 2012\n\n";
<stdin>;
exit(1);
}
#The End ?