Sfoglia il codice sorgente

Merge branch 'philsmd-pr-issue-36-permutation'

Jens Steube 10 anni fa
parent
commit
47ef58b910
2 ha cambiato i file con 11 aggiunte e 4 eliminazioni
  1. 6 1
      docs/changes.txt
  2. 5 3
      src/engine.c

+ 6 - 1
docs/changes.txt

@@ -10,11 +10,16 @@ file.: Host
 desc.: Fixed a possible memory problem for hash type -m 11400 = SIP digest authentication (MD5)
 issue: 10
 
-type.: bug
+type.: Bug
 file.: Host
 desc.: Fixed a problem with the -s / -l parameters in attack modes -a 0 (straight) and -a 3 (mask attack)
 issue: 2
 
+type.: Bug
+file.: Host
+desc.: Fixed the output of attack mode -a 4 (permutation attack)
+issue: 36
+
 * changes v0.50 -> v2.00:
 
 type: Project

+ 5 - 3
src/engine.c

@@ -15647,7 +15647,7 @@ void *attack_a4r0 (thread_parameter_t *thread_parameter)
 
     for (k = 0; k < words->words_len[words_next] + 1; k++) p[k] = k;
 
-    k = 1;
+    k = 0;
 
     /* main loop */
 
@@ -15657,16 +15657,18 @@ void *attack_a4r0 (thread_parameter_t *thread_parameter)
     {
       for (i = 0; i < 4; i++)
       {
-        if ((k = next_permutation (words->words_buf[words_next], p, k)) == words->words_len[words_next]) break;
+        k = next_permutation (words->words_buf[words_next], p, k);
 
         memcpy (ptrs[i], words->words_buf[words_next], words->words_len[words_next]);
 
         plains[i].pos = thread_parameter->thread_plains_done + i;  // TODO: needs verification
+
+        if (k == words->words_len[words_next]) break;
       }
 
       int j;
 
-      for (j = i; j < 4; j++)
+      for (j = i + 1; j < 4; j++) // the +1 is here because if < 4, we did use 'break' to exit the loop
       {
         memset (ptrs[j], 0, BLOCK_SIZE);