@@ -2038,6 +2038,7 @@ static void ldr_fill_user_words(struct db_main *db)
20382038int ldr_fix_database (struct db_main * db )
20392039{
20402040 int total = db -> password_count ;
2041+ int cracked = 0 ;
20412042
20422043 ldr_init_salts (db );
20432044 MEM_FREE (db -> password_hash );
@@ -2047,20 +2048,34 @@ int ldr_fix_database(struct db_main *db)
20472048 MEM_FREE (db -> salt_hash );
20482049
20492050 if (!ldr_loading_testdb ) {
2051+ FILE * out_file = options .loader .showuncracked ? stderr : stdout ;
2052+
20502053 if (db -> options -> best_pps ) {
20512054 ldr_sort_salts (db , 1 );
20522055 ldr_filter_n_best_salts (db );
20532056 } else
20542057 ldr_filter_salts (db );
2058+ int filtered = total - db -> password_count ;
2059+ if (filtered && john_main_process ) {
2060+ fprintf (out_file , "Removed %d password hash%s due to --salts\n" ,
2061+ filtered , filtered != 1 ? "es" : "" );
2062+ }
2063+
2064+ total = db -> password_count ;
20552065 ldr_filter_costs (db );
2066+ filtered = total - db -> password_count ;
2067+ if (filtered && john_main_process ) {
2068+ fprintf (out_file , "Removed %d password hash%s due to --cost\n" ,
2069+ filtered , filtered != 1 ? "es" : "" );
2070+ }
2071+
20562072 total = db -> password_count ;
20572073 ldr_remove_marked (db );
2074+ cracked = total - db -> password_count ;
20582075 if (options .loader .showuncracked ) {
2059- int cracked = total - db -> password_count ;
2060- if (john_main_process )
2061- fprintf (stderr , "%s%d password hash%s cracked,"
2062- " %d left\n" , cracked ? "\n" : "" , cracked ,
2063- cracked != 1 ? "es" : "" , db -> password_count );
2076+ fprintf (stderr , "%s%d password hash%s cracked, %d left\n" ,
2077+ cracked ? "\n" : "" , cracked ,
2078+ cracked != 1 ? "es" : "" , db -> password_count );
20642079 exit (0 );
20652080 }
20662081 }
@@ -2076,7 +2091,7 @@ int ldr_fix_database(struct db_main *db)
20762091 if (!ldr_loading_testdb && options .seed_per_user )
20772092 ldr_fill_user_words (db );
20782093
2079- return total ;
2094+ return cracked ;
20802095}
20812096
20822097static int ldr_cracked_hash (char * ciphertext )
0 commit comments