1
mirror of https://github.com/hashcat/hashcat synced 2024-11-24 14:27:14 +01:00

Bring back comparison of hashlist in crackfile

This commit is contained in:
jsteube 2018-12-27 15:49:18 +01:00
parent 97fc147aec
commit 7538e82b72
19 changed files with 76 additions and 39 deletions

View File

@ -203,18 +203,21 @@ sub verify
}
open (IN, '<', $cracks_file) or die "$cracks_file: $!\n";
open (OUT, '>', $out_file ) or die "$out_file: $!\n";
open (OUT, '>', $out_file) or die "$out_file: $!\n";
while (my $line = <IN>)
{
$line =~ s/\n$//;
$line =~ s/\r$//;
my $hash = module_verify_hash ($line);
my ($hash, $word) = module_verify_hash ($line);
# possible if the hash:password pair does not match
next unless defined $hash;
# check if the crack is okay
next unless $line eq ($hash . ":" . $word);
# possible if the hash is in cracksfile, but not in hashfile
next unless is_in_array ($hash, \@hashlist);

View File

@ -32,9 +32,11 @@ sub module_verify_hash
return unless defined $hash;
return unless defined $word;
$word = pack_if_HEX_notation ($word);
my $word_packed = pack_if_HEX_notation ($word);
return module_generate_hash ($word);
my $new_hash = module_generate_hash ($word_packed);
return ($new_hash, $word);
}
1;

View File

@ -34,9 +34,11 @@ sub module_verify_hash
return unless defined $salt;
return unless defined $word;
$word = pack_if_HEX_notation ($word);
my $word_packed = pack_if_HEX_notation ($word);
return module_generate_hash ($word, $salt);
my $new_hash = module_generate_hash ($word_packed, $salt);
return ($new_hash, $word);
}
1;

View File

@ -34,9 +34,11 @@ sub module_verify_hash
return unless defined $salt;
return unless defined $word;
$word = pack_if_HEX_notation ($word);
my $word_packed = pack_if_HEX_notation ($word);
return module_generate_hash ($word, $salt);
my $new_hash = module_generate_hash ($word_packed, $salt);
return ($new_hash, $word);
}
1;

View File

@ -34,9 +34,11 @@ sub module_verify_hash
return unless defined $salt;
return unless defined $word;
$word = pack_if_HEX_notation ($word);
my $word_packed = pack_if_HEX_notation ($word);
return module_generate_hash ($word, $salt);
my $new_hash = module_generate_hash ($word_packed, $salt);
return ($new_hash, $word);
}
1;

View File

@ -34,9 +34,11 @@ sub module_verify_hash
return unless defined $salt;
return unless defined $word;
$word = pack_if_HEX_notation ($word);
my $word_packed = pack_if_HEX_notation ($word);
return module_generate_hash ($word, $salt);
my $new_hash = module_generate_hash ($word_packed, $salt);
return ($new_hash, $word);
}
1;

View File

@ -34,9 +34,11 @@ sub module_verify_hash
return unless defined $salt;
return unless defined $word;
$word = pack_if_HEX_notation ($word);
my $word_packed = pack_if_HEX_notation ($word);
return module_generate_hash ($word, $salt);
my $new_hash = module_generate_hash ($word_packed, $salt);
return ($new_hash, $word);
}
1;

View File

@ -37,9 +37,11 @@ sub module_verify_hash
return unless defined $salt;
return unless defined $word;
$word = pack_if_HEX_notation ($word);
my $word_packed = pack_if_HEX_notation ($word);
return module_generate_hash ($word, $salt);
my $new_hash = module_generate_hash ($word_packed, $salt);
return ($new_hash, $word);
}
1;

View File

@ -35,9 +35,11 @@ sub module_verify_hash
return unless defined $salt;
return unless defined $word;
$word = pack_if_HEX_notation ($word);
my $word_packed = pack_if_HEX_notation ($word);
return module_generate_hash ($word, $salt);
my $new_hash = module_generate_hash ($word_packed, $salt);
return ($new_hash, $word);
}
1;

View File

@ -35,9 +35,11 @@ sub module_verify_hash
return unless defined $salt;
return unless defined $word;
$word = pack_if_HEX_notation ($word);
my $word_packed = pack_if_HEX_notation ($word);
return module_generate_hash ($word, $salt);
my $new_hash = module_generate_hash ($word_packed, $salt);
return ($new_hash, $word);
}
1;

View File

@ -32,9 +32,11 @@ sub module_verify_hash
return unless defined $hash;
return unless defined $word;
$word = pack_if_HEX_notation ($word);
my $word_packed = pack_if_HEX_notation ($word);
return module_generate_hash ($word);
my $new_hash = module_generate_hash ($word_packed);
return ($new_hash, $word);
}
1;

View File

@ -34,9 +34,11 @@ sub module_verify_hash
return unless defined $salt;
return unless defined $word;
$word = pack_if_HEX_notation ($word);
my $word_packed = pack_if_HEX_notation ($word);
return module_generate_hash ($word, $salt);
my $new_hash = module_generate_hash ($word_packed, $salt);
return ($new_hash, $word);
}
1;

View File

@ -34,9 +34,11 @@ sub module_verify_hash
return unless defined $salt;
return unless defined $word;
$word = pack_if_HEX_notation ($word);
my $word_packed = pack_if_HEX_notation ($word);
return module_generate_hash ($word, $salt);
my $new_hash = module_generate_hash ($word_packed, $salt);
return ($new_hash, $word);
}
1;

View File

@ -31,9 +31,11 @@ sub module_verify_hash
return unless defined $hash;
return unless defined $word;
$word = pack_if_HEX_notation ($word);
my $word_packed = pack_if_HEX_notation ($word);
return module_generate_hash ($word);
my $new_hash = module_generate_hash ($word_packed);
return ($new_hash, $word);
}
1;

View File

@ -29,11 +29,13 @@ sub module_verify_hash
return unless defined $hash;
return unless defined $word;
$word = pack_if_HEX_notation ($word);
my $word_packed = pack_if_HEX_notation ($word);
my $salt = substr ($hash, 0, 2);
return module_generate_hash ($word, $salt);
my $new_hash = module_generate_hash ($word_packed, $salt);
return ($new_hash, $word);
}
1;

View File

@ -66,9 +66,9 @@ sub module_verify_hash
$cli_ch = substr ($line, $index2 + 3 + 16 + 32, $index3 - $index2 - 3 - 16 - 32);
$word = substr ($line, $index3 + 1);
$word = pack_if_HEX_notation ($word);
my $word_packed = pack_if_HEX_notation ($word);
my $new_hash = module_generate_hash ($word, $user, $domain, $srv_ch, $cli_ch);
my $new_hash = module_generate_hash ($word_packed_packed, $user, $domain, $srv_ch, $cli_ch);
# resolve lowercase/uppercase ambiguity in the username
# this will also guarantee a match with the preprocessed hashlist
@ -77,7 +77,7 @@ sub module_verify_hash
return unless $new_hash eq $hash;
return $new_hash;
return ($new_hash, $word);
}
# algorithm is case-insensitive in regard to usernames

View File

@ -54,7 +54,7 @@ sub module_verify_hash
return unless defined $hash;
return unless defined $word;
$word = pack_if_HEX_notation ($word);
my $word_packed = pack_if_HEX_notation ($word);
# tokenize
my @data = split ('\*', $hash);
@ -102,7 +102,9 @@ sub module_verify_hash
my $b_plain = $cbc->decrypt ($b_cipher, $key, $b_iv);
my $plain = unpack ('H*', $b_plain);
return module_generate_hash ($word, $salt, $iter, $iv, $plain);
my $new_hash = module_generate_hash ($word_packed_packed, $salt, $iter, $iv, $plain);
return ($new_hash, $word);
}
1;

View File

@ -31,9 +31,11 @@ sub module_verify_hash
return unless defined $hash;
return unless defined $word;
$word = pack_if_HEX_notation ($word);
my $word_packed = pack_if_HEX_notation ($word);
return module_generate_hash ($word);
my $new_hash = module_generate_hash ($word_packed);
return ($new_hash, $word);
}
1;

View File

@ -67,7 +67,7 @@ sub module_verify_hash
return unless defined $hash;
return unless defined $word;
$word = pack_if_HEX_notation ($word);
my $word_packed = pack_if_HEX_notation ($word);
# tokenize
my @data = split ('\*', $hash);
@ -128,7 +128,9 @@ sub module_verify_hash
my $plain = unpack ('H*', $b_plain);
return module_generate_hash ($word, $salt, $iter, $iv, $plain);
my $new_hash = module_generate_hash ($word_packed_packed, $salt, $iter, $iv, $plain);
return ($new_hash, $word);
}
1;