Refactored 134 to 13500. Added esalt struct
authorMartin Lemay <mlemay@gosecure.ca>
Fri, 22 Apr 2016 16:26:03 +0000 (12:26 -0400)
committerMartin Lemay <mlemay@gosecure.ca>
Fri, 22 Apr 2016 16:26:03 +0000 (12:26 -0400)
include/shared.h
include/types.h
src/oclHashcat.c
src/shared.c

index 98a94b8..a4d271f 100644 (file)
@@ -348,6 +348,7 @@ extern hc_thread_mutex_t mux_display;
 #define HT_13200  "AxCrypt"
 #define HT_13300  "AxCrypt in memory SHA1"
 #define HT_13400  "Keepass 1 (AES/Twofish) and Keepass 2 (AES)"
+#define HT_13500  "PeopleSoft PS_TOKEN"
 
 #define HT_00011  "Joomla < 2.5.18"
 #define HT_00012  "PostgreSQL"
@@ -364,7 +365,6 @@ extern hc_thread_mutex_t mux_display;
 #define HT_00131  "MSSQL(2000)"
 #define HT_00132  "MSSQL(2005)"
 #define HT_00133  "PeopleSoft"
-#define HT_00134  "PeopleSoft PS_TOKEN"
 #define HT_00141  "EPiServer 6.x < v4"
 #define HT_01421  "hMailServer"
 #define HT_01441  "EPiServer 6.x > v4"
@@ -691,6 +691,8 @@ extern hc_thread_mutex_t mux_display;
 #define DISPLAY_LEN_MAX_13300  1 + 12 + 1 + 40
 #define DISPLAY_LEN_MIN_13400  1 + 7 + 1 + 1 + 1 + 1 + 1 + 1 + 32 + 1 + 64 + 1 + 32 + 1 + 64 + 1 + 1 + 1 + 1
 #define DISPLAY_LEN_MAX_13400  1 + 7 + 1 + 1 + 10 + 1 + 3 + 1 + 64 + 1 + 64 + 1 + 32 + 1 + 64 + 1 + 4 + 1 + 600000 + 1 + 2 + 1 + 64
+#define DISPLAY_LEN_MIN_13500 40 + 1 + 16 * 2
+#define DISPLAY_LEN_MAX_13500 40 + 1 + 512 * 2
 
 #define DISPLAY_LEN_MIN_11    32 + 1 + 16
 #define DISPLAY_LEN_MAX_11    32 + 1 + 32
@@ -732,8 +734,6 @@ extern hc_thread_mutex_t mux_display;
 #define DISPLAY_LEN_MAX_132    6 +  8 + 40
 #define DISPLAY_LEN_MIN_133   28
 #define DISPLAY_LEN_MAX_133   28
-#define DISPLAY_LEN_MIN_134   40 + 150
-#define DISPLAY_LEN_MAX_134   40 + 300
 #define DISPLAY_LEN_MIN_141   14 +  0 +  1 + 28
 #define DISPLAY_LEN_MAX_141   14 + 44 +  1 + 28
 #define DISPLAY_LEN_MIN_1441  14 +  0 +  1 + 43
@@ -1478,7 +1478,6 @@ int netntlmv2_parse_hash          (char *input_buf, uint input_len, hash_t *hash
 int oracleh_parse_hash            (char *input_buf, uint input_len, hash_t *hash_buf);
 int oracles_parse_hash            (char *input_buf, uint input_len, hash_t *hash_buf);
 int oraclet_parse_hash            (char *input_buf, uint input_len, hash_t *hash_buf);
-int pstoken_parse_hash            (char *input_buf, uint input_len, hash_t *hash_buf);
 int osc_parse_hash                (char *input_buf, uint input_len, hash_t *hash_buf);
 int arubaos_parse_hash            (char *input_buf, uint input_len, hash_t *hash_buf);
 int osx1_parse_hash               (char *input_buf, uint input_len, hash_t *hash_buf);
@@ -1598,6 +1597,7 @@ int androidfde_samsung_parse_hash (char *input_buf, uint input_len, hash_t *hash
 int axcrypt_parse_hash            (char *input_buf, uint input_len, hash_t *hash_buf);
 int sha1axcrypt_parse_hash        (char *input_buf, uint input_len, hash_t *hash_buf);
 int keepass_parse_hash            (char *input_buf, uint input_len, hash_t *hash_buf);
+int pstoken_parse_hash            (char *input_buf, uint input_len, hash_t *hash_buf);
 
 void load_kernel (const char *kernel_file, int num_devices, size_t *kernel_lengths, const u8 **kernel_sources);
 void writeProgramBin (char *dst, u8 *binary, size_t binary_size);
index 4766696..5f67593 100644 (file)
@@ -702,6 +702,13 @@ typedef struct
 
 } psafe3_t;
 
+typedef struct 
+{
+  u32 salt_buf[128];
+  u32 salt_len;
+
+} pstoken_t;
+
 typedef struct
 {
   char    plain_buf[256];
index aed7fbe..908b3f6 100644 (file)
@@ -268,7 +268,6 @@ static uint default_benchmark_algorithms[NUM_DEFAULT_BENCHMARK_ALGORITHMS] =
   8700,
   9100,
   133,
-  134,
   11600,
   12500,
   13000,
@@ -301,6 +300,7 @@ static uint default_benchmark_algorithms[NUM_DEFAULT_BENCHMARK_ALGORITHMS] =
   11300,
   12700,
   13400,
+  13500,
   125
 };
 
@@ -697,7 +697,7 @@ const char *USAGE_BIG[] =
   "   8700 = Lotus Notes/Domino 6",
   "   9100 = Lotus Notes/Domino 8",
   "    133 = PeopleSoft",
-  "    134 = PeopleSoft Token",
+  "  13500 = PeopleSoft Token",
   "",
   "[[ Archives ]]",
   "",
@@ -5964,7 +5964,7 @@ int main (int argc, char **argv)
     return (-1);
   }
 
-  if (hash_mode_chgd && hash_mode > 13400) // just added to remove compiler warnings for hash_mode_chgd
+  if (hash_mode_chgd && hash_mode > 13500) // just added to remove compiler warnings for hash_mode_chgd
   {
     log_error ("ERROR: Invalid hash-type specified");
 
@@ -7450,30 +7450,6 @@ int main (int argc, char **argv)
                    dgst_pos2   = 2;
                    dgst_pos3   = 1;
                    break;
-      
-     case   134:   hash_type   = HASH_TYPE_SHA1;
-                   salt_type   = SALT_TYPE_INTERN;
-                   attack_exec = ATTACK_EXEC_INSIDE_KERNEL;
-                   opts_type   = OPTS_TYPE_PT_GENERATE_BE
-                               | OPTS_TYPE_PT_UNICODE
-                               | OPTS_TYPE_ST_ADD80
-                               | OPTS_TYPE_ST_ADDBITS15;
-                   kern_type   = KERN_TYPE_SHA1_SLTPWU;
-                   dgst_size   = DGST_SIZE_4_5;
-                   parse_func  = pstoken_parse_hash;
-                   sort_by_digest = sort_by_digest_4_5;
-                   opti_type   = OPTI_TYPE_ZERO_BYTE
-                               | OPTI_TYPE_PRECOMPUTE_INIT
-                               | OPTI_TYPE_PRECOMPUTE_MERKLE
-                               | OPTI_TYPE_EARLY_SKIP
-                               | OPTI_TYPE_NOT_ITERATED
-                               | OPTI_TYPE_PREPENDED_SALT
-                               | OPTI_TYPE_RAW_HASH;
-                   dgst_pos0   = 3;
-                   dgst_pos1   = 4;
-                   dgst_pos2   = 2;
-                   dgst_pos3   = 1;
-                   break;
 
       case   140:  hash_type   = HASH_TYPE_SHA1;
                    salt_type   = SALT_TYPE_INTERN;
@@ -10314,6 +10290,30 @@ int main (int argc, char **argv)
                    dgst_pos3   = 3;
                    break;
 
+      case 13500:  hash_type   = HASH_TYPE_SHA1;
+                   salt_type   = SALT_TYPE_EMBEDDED;
+                   attack_exec = ATTACK_EXEC_INSIDE_KERNEL;
+                   opts_type   = OPTS_TYPE_PT_GENERATE_BE
+                               | OPTS_TYPE_PT_UNICODE
+                               | OPTS_TYPE_ST_ADD80
+                               | OPTS_TYPE_ST_ADDBITS15;
+                   kern_type   = KERN_TYPE_SHA1_SLTPWU;
+                   dgst_size   = DGST_SIZE_4_5;
+                   parse_func  = pstoken_parse_hash;
+                   sort_by_digest = sort_by_digest_4_5;
+                   opti_type   = OPTI_TYPE_ZERO_BYTE
+                               | OPTI_TYPE_PRECOMPUTE_INIT
+                               | OPTI_TYPE_PRECOMPUTE_MERKLE
+                               | OPTI_TYPE_EARLY_SKIP
+                               | OPTI_TYPE_NOT_ITERATED
+                               | OPTI_TYPE_PREPENDED_SALT
+                               | OPTI_TYPE_RAW_HASH;
+                   dgst_pos0   = 3;
+                   dgst_pos1   = 4;
+                   dgst_pos2   = 2;
+                   dgst_pos3   = 1;
+                   break;
+
       default:     usage_mini_print (PROGNAME); return (-1);
     }
 
@@ -10419,6 +10419,7 @@ int main (int argc, char **argv)
       case 13000:  esalt_size = sizeof (rar5_t);          break;
       case 13100:  esalt_size = sizeof (krb5tgs_t);       break;
       case 13400:  esalt_size = sizeof (keepass_t);       break;
+      case 13500:  esalt_size = sizeof (pstoken_t);       break;
     }
 
     data.esalt_size = esalt_size;
index dfe9e71..84196f8 100644 (file)
@@ -5696,7 +5696,6 @@ char *strhashtype (const uint hash_mode)
     case   131: return ((char *) HT_00131); break;
     case   132: return ((char *) HT_00132); break;
     case   133: return ((char *) HT_00133); break;
-    case   134: return ((char *) HT_00134); break;
     case   140: return ((char *) HT_00140); break;
     case   141: return ((char *) HT_00141); break;
     case   150: return ((char *) HT_00150); break;
@@ -5854,6 +5853,7 @@ char *strhashtype (const uint hash_mode)
     case 13200: return ((char *) HT_13200); break;
     case 13300: return ((char *) HT_13300); break;
     case 13400: return ((char *) HT_13400); break;
+    case 13500: return ((char *) HT_13500); break;
   }
 
   return ((char *) "Unknown");
@@ -11760,16 +11760,16 @@ int pstoken_parse_hash (char *input_buf, uint input_len, hash_t *hash_buf)
 {
   if (data.opts_type & OPTS_TYPE_ST_HEX)
   {
-    if ((input_len < DISPLAY_LEN_MIN_134) || (input_len > DISPLAY_LEN_MAX_134)) return (PARSER_GLOBAL_LENGTH);
+    if ((input_len < DISPLAY_LEN_MIN_13500) || (input_len > DISPLAY_LEN_MAX_13500)) return (PARSER_GLOBAL_LENGTH);
   }
   else
   {
-    if ((input_len < DISPLAY_LEN_MIN_134) || (input_len > DISPLAY_LEN_MAX_134)) return (PARSER_GLOBAL_LENGTH);
+    if ((input_len < DISPLAY_LEN_MIN_13500) || (input_len > DISPLAY_LEN_MAX_13500)) return (PARSER_GLOBAL_LENGTH);
   }
 
   u32 *digest = (u32 *) hash_buf->digest;
-
   salt_t *salt = hash_buf->salt;
+  pstoken_t *pstoken = (pstoken_t *) hash_buf->esalt;
 
   digest[0] = hex_to_u32 ((const u8 *) &input_buf[ 0]);
   digest[1] = hex_to_u32 ((const u8 *) &input_buf[ 8]);
@@ -11789,13 +11789,13 @@ int pstoken_parse_hash (char *input_buf, uint input_len, hash_t *hash_buf)
 
   char *salt_buf = input_buf + 40 + 1;
 
-  char *salt_buf_ptr = (char *) salt->salt_buf;
-
-  salt_len = parse_and_store_salt (salt_buf_ptr, salt_buf, salt_len);
-
   if (salt_len == UINT_MAX) return (PARSER_SALT_LENGTH);
 
   salt->salt_len = salt_len;
+  pstoken->salt_len = salt_len;
+
+  memcpy(salt->salt_buf, salt_buf, 16);
+  memcpy(pstoken->salt_buf, salt_buf, salt_len);
 
   return (PARSER_OK);
 }