mirror of
https://github.com/hashcat/hashcat.git
synced 2024-11-22 08:08:10 +00:00
Add -m 10300 unit test
This commit is contained in:
parent
942acb266e
commit
07fa13b695
@ -244,7 +244,8 @@ function init()
|
|||||||
sed 's/^echo *|/echo "" |/' ${cmd_file} | awk '{print $10}' | cut -d"'" -f2 > ${OUTD}/${hash_type}_hashes.txt
|
sed 's/^echo *|/echo "" |/' ${cmd_file} | awk '{print $10}' | cut -d"'" -f2 > ${OUTD}/${hash_type}_hashes.txt
|
||||||
|
|
||||||
if [ "${hash_type}" -eq 10300 ]; then
|
if [ "${hash_type}" -eq 10300 ]; then
|
||||||
cat ${OUTD}/${hash_type}.sh | cut -d' ' -f11- | cut -d"'" -f2 > ${OUTD}/${hash_type}_hashes.txt
|
#cat ${OUTD}/${hash_type}.sh | cut -d' ' -f11- | cut -d"'" -f2 > ${OUTD}/${hash_type}_hashes.txt
|
||||||
|
cat ${OUTD}/${hash_type}.sh | cut -d"'" -f2 > ${OUTD}/${hash_type}_hashes.txt
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# truncate dicts
|
# truncate dicts
|
||||||
@ -352,7 +353,8 @@ function init()
|
|||||||
sed 's/^echo *|/echo "" |/' ${cmd_file} | awk '{print $10}' | cut -d"'" -f2 > ${OUTD}/${hash_type}_hashes_multi_${i}.txt
|
sed 's/^echo *|/echo "" |/' ${cmd_file} | awk '{print $10}' | cut -d"'" -f2 > ${OUTD}/${hash_type}_hashes_multi_${i}.txt
|
||||||
|
|
||||||
if [ "${hash_type}" -eq 10300 ]; then
|
if [ "${hash_type}" -eq 10300 ]; then
|
||||||
cat ${OUTD}/${hash_type}_multi_${i}.txt | cut -d' ' -f11- | cut -d"'" -f2 > ${OUTD}/${hash_type}_hashes_multi_${i}.txt
|
#cat ${OUTD}/${hash_type}_multi_${i}.txt | cut -d' ' -f11- | cut -d"'" -f2 > ${OUTD}/${hash_type}_hashes_multi_${i}.txt
|
||||||
|
cat ${OUTD}/${hash_type}_multi_${i}.txt | cut -d"'" -f2 > ${OUTD}/${hash_type}_hashes_multi_${i}.txt
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# split password, 'i' is the len
|
# split password, 'i' is the len
|
||||||
|
75
tools/test_modules/m10300.pm
Normal file
75
tools/test_modules/m10300.pm
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
#!/usr/bin/env perl
|
||||||
|
|
||||||
|
##
|
||||||
|
## Author......: See docs/credits.txt
|
||||||
|
## License.....: MIT
|
||||||
|
##
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
|
use Digest::SHA qw (sha1);
|
||||||
|
use MIME::Base64 qw (encode_base64 decode_base64);
|
||||||
|
|
||||||
|
sub module_constraints { [[0, 40], [4, 15], [-1, -1], [-1, -1], [-1, -1]] }
|
||||||
|
|
||||||
|
sub module_generate_hash
|
||||||
|
{
|
||||||
|
my $word = shift;
|
||||||
|
my $salt = shift;
|
||||||
|
my $iter = shift // 1024;
|
||||||
|
|
||||||
|
my $hash_buf = $salt;
|
||||||
|
|
||||||
|
for (my $pos = 0; $pos < $iter; $pos++)
|
||||||
|
{
|
||||||
|
$hash_buf = sha1 ($word . $hash_buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
$hash_buf = encode_base64 ($hash_buf . $salt, "");
|
||||||
|
|
||||||
|
my $hash = sprintf ("{x-issha, %i}%s", $iter, $hash_buf);
|
||||||
|
|
||||||
|
return $hash;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub module_verify_hash
|
||||||
|
{
|
||||||
|
my $line = shift;
|
||||||
|
|
||||||
|
my ($hash_in, $word) = split (/:/, $line);
|
||||||
|
|
||||||
|
return unless defined $hash_in;
|
||||||
|
|
||||||
|
# SAP CODVN H (PWDSALTEDHASH) iSSHA-1
|
||||||
|
return unless (substr ($hash_in, 0, 10) eq '{x-issha, ');
|
||||||
|
|
||||||
|
# get iterations
|
||||||
|
|
||||||
|
my $index1 = index ($hash_in, "}", 10);
|
||||||
|
|
||||||
|
return if $index1 < 1;
|
||||||
|
|
||||||
|
my $iter = substr ($hash_in, 10, $index1 - 10);
|
||||||
|
|
||||||
|
$iter = int ($iter);
|
||||||
|
|
||||||
|
# base64 substring
|
||||||
|
|
||||||
|
my $base64_encoded = substr ($hash_in, $index1 + 1);
|
||||||
|
my $base64_decoded = decode_base64 ($base64_encoded);
|
||||||
|
|
||||||
|
my $salt = substr ($base64_decoded, 20);
|
||||||
|
|
||||||
|
return unless defined $salt;
|
||||||
|
return unless defined $iter;
|
||||||
|
return unless defined $word;
|
||||||
|
|
||||||
|
$word = pack_if_HEX_notation ($word);
|
||||||
|
|
||||||
|
my $new_hash = module_generate_hash ($word, $salt, $iter);
|
||||||
|
|
||||||
|
return ($new_hash, $word);
|
||||||
|
}
|
||||||
|
|
||||||
|
1;
|
Loading…
Reference in New Issue
Block a user