mirror of
https://github.com/hashcat/hashcat.git
synced 2024-11-15 20:39:17 +00:00
Merge pull request #1861 from s3inlc/test-plugin-133_140_141
Added test modules for mode 133, 140 and 141
This commit is contained in:
commit
1f398f7626
46
tools/test_modules/m00133.pm
Normal file
46
tools/test_modules/m00133.pm
Normal file
@ -0,0 +1,46 @@
|
||||
#!/usr/bin/env perl
|
||||
|
||||
##
|
||||
## Author......: See docs/credits.txt
|
||||
## License.....: MIT
|
||||
##
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use Digest::SHA1 qw (sha1);
|
||||
use MIME::Base64 qw (encode_base64);
|
||||
use Encode;
|
||||
|
||||
sub module_constraints { [[0, 255], [-1, -1], [0, 27], [-1, -1], [-1, -1]] }
|
||||
|
||||
sub module_generate_hash
|
||||
{
|
||||
my $word = shift;
|
||||
|
||||
my $digest = sha1 (encode ("UTF-16LE", $word));
|
||||
|
||||
$digest = encode_base64 ($digest, "");
|
||||
|
||||
my $hash = sprintf ("%s", $digest);
|
||||
|
||||
return $hash;
|
||||
}
|
||||
|
||||
sub module_verify_hash
|
||||
{
|
||||
my $line = shift;
|
||||
|
||||
my ($hash, $word) = split (':', $line);
|
||||
|
||||
return unless defined $hash;
|
||||
return unless defined $word;
|
||||
|
||||
$word = pack_if_HEX_notation ($word);
|
||||
|
||||
my $new_hash = module_generate_hash ($word);
|
||||
|
||||
return ($new_hash, $word);
|
||||
}
|
||||
|
||||
1;
|
45
tools/test_modules/m00140.pm
Normal file
45
tools/test_modules/m00140.pm
Normal file
@ -0,0 +1,45 @@
|
||||
#!/usr/bin/env perl
|
||||
|
||||
##
|
||||
## Author......: See docs/credits.txt
|
||||
## License.....: MIT
|
||||
##
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use Digest::SHA1 qw (sha1_hex);
|
||||
use Encode;
|
||||
|
||||
sub module_constraints { [[0, 255], [0, 255], [0, 27], [0, 55], [0, 27]] }
|
||||
|
||||
sub module_generate_hash
|
||||
{
|
||||
my $word = shift;
|
||||
my $salt = shift;
|
||||
|
||||
my $digest = sha1_hex ($salt . encode ("UTF-16LE", $word));
|
||||
|
||||
my $hash = sprintf ("%s:%s", $digest, $salt);
|
||||
|
||||
return $hash;
|
||||
}
|
||||
|
||||
sub module_verify_hash
|
||||
{
|
||||
my $line = shift;
|
||||
|
||||
my ($hash, $salt, $word) = split (':', $line);
|
||||
|
||||
return unless defined $hash;
|
||||
return unless defined $salt;
|
||||
return unless defined $word;
|
||||
|
||||
$word = pack_if_HEX_notation ($word);
|
||||
|
||||
my $new_hash = module_generate_hash ($word, $salt);
|
||||
|
||||
return ($new_hash, $word);
|
||||
}
|
||||
|
||||
1;
|
58
tools/test_modules/m00141.pm
Normal file
58
tools/test_modules/m00141.pm
Normal file
@ -0,0 +1,58 @@
|
||||
#!/usr/bin/env perl
|
||||
|
||||
##
|
||||
## Author......: See docs/credits.txt
|
||||
## License.....: MIT
|
||||
##
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use Digest::SHA1 qw (sha1);
|
||||
use MIME::Base64 qw (encode_base64 decode_base64);
|
||||
use Encode;
|
||||
|
||||
sub module_constraints { [[0, 255], [0, 255], [0, 27], [0, 55], [0, 27]] }
|
||||
|
||||
sub module_generate_hash
|
||||
{
|
||||
my $word = shift;
|
||||
my $salt = shift;
|
||||
|
||||
my $digest = sha1 ($salt . encode ("UTF-16LE", $word));
|
||||
|
||||
my $base64_salt_buf = encode_base64 ($salt, "");
|
||||
my $base64_hash_buf = encode_base64 ($digest, "");
|
||||
|
||||
$base64_hash_buf = substr ($base64_hash_buf, 0, 27);
|
||||
|
||||
my $hash = sprintf ("\$episerver\$*0*%s*%s", $base64_salt_buf, $base64_hash_buf);
|
||||
|
||||
return $hash;
|
||||
}
|
||||
|
||||
sub module_verify_hash
|
||||
{
|
||||
my $line = shift;
|
||||
|
||||
my ($digest, $word) = split (':', $line);
|
||||
|
||||
$digest = substr ($digest, 14);
|
||||
|
||||
my ($base64_salt, $base64_hash) = split ('\*', $digest);
|
||||
|
||||
my $hash = decode_base64 ($base64_hash);
|
||||
my $salt = decode_base64 ($base64_salt);
|
||||
|
||||
return unless defined $hash;
|
||||
return unless defined $salt;
|
||||
return unless defined $word;
|
||||
|
||||
$word = pack_if_HEX_notation ($word);
|
||||
|
||||
my $new_hash = module_generate_hash ($word, $salt);
|
||||
|
||||
return ($new_hash, $word);
|
||||
}
|
||||
|
||||
1;
|
Loading…
Reference in New Issue
Block a user