int hashcat_session_execute (hashcat_ctx_t *hashcat_ctx) { logfile_ctx_t *logfile_ctx = hashcat_ctx->logfile_ctx; status_ctx_t *status_ctx = hashcat_ctx->status_ctx; user_options_t *user_options = hashcat_ctx->user_options; // start logfile entry const hc_time_t proc_start = hc_time (NULL); logfile_generate_topid (hashcat_ctx); logfile_top_msg ("START"); // add all user options to logfile in case we want to debug some user session user_options_logger (hashcat_ctx); // read dictionary cache dictstat_read (hashcat_ctx); /** * outer loop */ EVENT (EVENT_OUTERLOOP_STARTING); int rc_final = -1; if (user_options->benchmark == true) { user_options->quiet = true; if (user_options->hash_mode_chgd == true) { rc_final = outer_loop (hashcat_ctx); if (rc_final == -1) myabort (hashcat_ctx); } else { for (u32 algorithm_pos = 0; algorithm_pos < DEFAULT_BENCHMARK_ALGORITHMS_CNT; algorithm_pos++) { user_options->hash_mode = DEFAULT_BENCHMARK_ALGORITHMS_BUF[algorithm_pos]; rc_final = outer_loop (hashcat_ctx); if (rc_final == -1) myabort (hashcat_ctx); if (status_ctx->run_main_level1 == false) break; } } user_options->quiet = false; } else { if (user_options->speed_only == true) user_options->quiet = true; rc_final = outer_loop (hashcat_ctx); if (rc_final == -1) myabort (hashcat_ctx); if (user_options->speed_only == true) user_options->quiet = false; } EVENT (EVENT_OUTERLOOP_FINISHED); // if exhausted or cracked, unlink the restore file unlink_restore (hashcat_ctx); // final update dictionary cache dictstat_write (hashcat_ctx); // final logfile entry const hc_time_t proc_stop = hc_time (NULL); logfile_top_uint (proc_start); logfile_top_uint (proc_stop); logfile_top_msg ("STOP"); // free memory if (rc_final == 0) { if (status_ctx->devices_status == STATUS_ABORTED_RUNTIME) rc_final = 4; if (status_ctx->devices_status == STATUS_ABORTED_CHECKPOINT) rc_final = 3; if (status_ctx->devices_status == STATUS_ABORTED) rc_final = 2; if (status_ctx->devices_status == STATUS_QUIT) rc_final = 2; if (status_ctx->devices_status == STATUS_EXHAUSTED) rc_final = 1; if (status_ctx->devices_status == STATUS_CRACKED) rc_final = 0; } // done return rc_final; }
/* * L3_iteration_loop: * ------------------ */ void L3_iteration_loop(struct config_t *cfg, double pe[][2], long mdct_freq_org[2][2][samp_per_frame2], L3_psy_ratio_t *ratio, L3_side_info_t *side_info, int l3_enc[2][2][samp_per_frame2], int mean_bits, L3_scalefac_t *scalefactor) { L3_psy_xmin_t l3_xmin; gr_info *cod_info; int *main_data_begin; int max_bits; int ch, gr, i; static int firstcall = 1; int *ix; main_data_begin = &side_info->main_data_begin; if ( firstcall ) { *main_data_begin = 0; firstcall=0; } scalefac_band_long = &sfBandIndex[cfg->mpeg.samplerate_index + (cfg->mpeg.type * 3)].l[0]; for(ch=cfg->wave.channels; ch--; ) { for(gr=0; gr<2; gr++) { /* setup pointers */ ix = l3_enc[gr][ch]; xr = mdct_freq_org[gr][ch]; /* Precalculate the square, abs, and maximum, * for use later on. */ for (i=samp_per_frame2, xrmax=0; i--;) { xrsq[i] = mulsr(xr[i],xr[i]); xrabs[i] = labs(xr[i]); if(xrabs[i]>xrmax) xrmax=xrabs[i]; } cod_info = (gr_info *) &(side_info->gr[gr].ch[ch]); cod_info->sfb_lmax = SFB_LMAX - 1; /* gr_deco */ calc_xmin(ratio, cod_info, &l3_xmin, gr, ch ); calc_scfsi(side_info,&l3_xmin,ch,gr); /* calculation of number of available bit( per granule ) */ max_bits = ResvMaxBits(cfg, side_info,&pe[gr][ch],mean_bits); /* reset of iteration variables */ memset(scalefactor->l[gr][ch],0,22); memset(scalefactor->s[gr][ch],0,14); for ( i=4; i--; ) cod_info->slen[i] = 0; cod_info->part2_3_length = 0; cod_info->big_values = 0; cod_info->count1 = 0; cod_info->scalefac_compress = 0; cod_info->table_select[0] = 0; cod_info->table_select[1] = 0; cod_info->table_select[2] = 0; cod_info->region0_count = 0; cod_info->region1_count = 0; cod_info->part2_length = 0; cod_info->preflag = 0; cod_info->scalefac_scale = 0; cod_info->count1table_select= 0; /* all spectral values zero ? */ if(xrmax) cod_info->part2_3_length = outer_loop(max_bits,&l3_xmin,ix, scalefactor, gr,ch,side_info ); ResvAdjust(cfg, cod_info, side_info, mean_bits ); cod_info->global_gain = cod_info->quantizerStepSize+210; } /* for gr */ } /* for ch */ ResvFrameEnd(cfg, side_info,mean_bits); }