Fixed -m 13500 kernels and tests
[hashcat.git] / tools / test.pl
index a7552de..61e62ef 100755 (executable)
@@ -18,7 +18,7 @@ use Digest::HMAC_MD5 qw (hmac_md5);
 use Digest::CRC      qw (crc32);
 use Crypt::PBKDF2;
 use Crypt::DES;
-use Crypt::ECB 2.00,       qw (encrypt);
+use Crypt::ECB       qw (encrypt);
 use Crypt::CBC;
 use Crypt::Eksblowfish::Bcrypt qw (bcrypt en_base64);
 use Crypt::Digest::RIPEMD160   qw (ripemd160_hex);
@@ -7156,7 +7156,7 @@ END_CODE
   }
   elsif ($mode == 13500)
   {
-    $hash_buf = sha1_hex (pack("H*",$salt_buf) . encode ("UTF-16LE", $word_buf));
+    $hash_buf = sha1_hex (pack ("H*", $salt_buf) . encode ("UTF-16LE", $word_buf));
 
     $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf);
   }
@@ -8659,19 +8659,14 @@ sub get_random_keepass_salt
 
 sub get_pstoken_salt
 {
- # Cannot be fully random because of the salt structure, will use a constant salt.
- my $pstoken_const = 
- "\x71\x00\x00\x00\x04\x03\x02\x01\x01\x00\x00\x00\xbc\x02" .
- "\x00\x00\x00\x00\x00\x00\x10\x50\x00\x50\x00\x57\x00\x45" .
- "\x00\x42\x00\x45\x00\x58\x00\x54\x00\x06\x45\x00\x4e\x00" .
- "\x47\x00\x0e\x50\x00\x53\x00\x46\x00\x54\x00\x5f\x00\x48" .
- "\x00\x52\x00\x34\x32\x00\x30\x00\x31\x00\x36\x00\x2d\x00" .
- "\x30\x00\x34\x00\x2d\x00\x30\x00\x38\x00\x2d\x00\x31\x00" .
- "\x39\x00\x2e\x00\x32\x00\x37\x00\x2e\x00\x30\x00\x35\x00" .
- "\x2e\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x32\x00" .
- "\x00";
-
- return unpack ("H*", $pstoken_const);
+  my $pstoken_length = get_random_num (16, 256);
+
+  ## not a valid pstoken but a better test
+  ## because of random length
+
+  my $pstoken_const = randbytes ($pstoken_length);
+
+  return unpack ("H*", $pstoken_const);
 }
 
 sub get_random_md5chap_salt