Commits

cr0hn committed f9277a1

fixed a bug when you have a huge list of wordlist. Fixed also, each iteration now is saved into the results file

Signed-off-by: alone <alone.in.the.shell@gmail.com>

  • Participants
  • Parent commits 990bdd3

Comments (0)

Files changed (2)

     //usi has_output=FALSE;
     //usi has_file=FALSE;
     //usi has_word=FALSE;
-    unsigned long i;
+    unsigned long i, j, total_mutations = 0;
     int fdin, fdout,s;
-    s_list list;
-    s_word aux, * word = &aux;
+    s_list list,list_out;
+    s_word aux, * word = &aux, * word_out = &aux;
     //s_opts options ={ FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {'\0'}}; 
 
     //word = (s_word*)amalloc(sizeof(s_word));
     else
         usage();
 
-    mutator(&list);
+    printf("[+] Number of words to mutate: %ld\n",list.count);
 
-    word = list.first;
-    for (i=0;i<list.count;i++)
+    word_out = list.first;
+    for (j=0;j<list.count; j++)
     {
-        write_word(fdout, word);        
-        word = word->next;
+	list_new(&list_out);
+	list_add_item(&list_out, word_out); 
+	
+	mutator(&list_out);
+
+	word = list_out.first;
+	for (i=0;i<list_out.count;i++)
+	{
+		write_word(fdout, word);        
+		word = word->next;
+	}
+	
+	total_mutations += list_out.count;
+
+	word_out = word_out->next;
+
+	list_destroy(&list_out);
     }
 
     list_destroy(&list);
     //free(word);
     close(fdout);
 
+    printf("[+] Number of words to mutate: %ld\n", total_mutations);
+
     return 0;
 }
 
 
     waux.word = (char*)amalloc(WORDSIZE);
 
-    printf("[+] Number of words to mutate: %ld\n",list->count);
+    printf("[+] Current word: '%s'\n", list->first->word);
 
     if(! options.do_adv )
     {
             p_table_adv[i](list);
     }
 
-    printf("[+] Total of mutations generated: %ld\n",list->count);
 }
 
 /*
     printf("%ld\n",laux.count);
     list_concatenate(list, &laux);
 
-    printf("[*] Just done!\n");
     free(dest->word);
     free(dest);
     list_destroy(&laux);