1
0
mirror of https://github.com/hashcat/hashcat.git synced 2025-06-27 18:32:36 +00:00

(hashcat) remove unused *rc* vars and cleanup

This commit is contained in:
Gabriele Gristina 2019-07-10 17:10:15 +02:00
parent a7fd1e40f8
commit c88250e437

View File

@ -117,17 +117,13 @@ static int inner2_loop (hashcat_ctx_t *hashcat_ctx)
* Update attack-mode specific stuff based on mask * Update attack-mode specific stuff based on mask
*/ */
const int rc_mask_ctx_update_loop = mask_ctx_update_loop (hashcat_ctx); if (mask_ctx_update_loop (hashcat_ctx) == -1) return 0;
if (rc_mask_ctx_update_loop == -1) return 0;
/** /**
* Update attack-mode specific stuff based on wordlist * Update attack-mode specific stuff based on wordlist
*/ */
const int rc_straight_ctx_update_loop = straight_ctx_update_loop (hashcat_ctx); if (straight_ctx_update_loop (hashcat_ctx) == -1) return 0;
if (rc_straight_ctx_update_loop == -1) return 0;
// words base // words base
@ -349,9 +345,7 @@ static int inner2_loop (hashcat_ctx_t *hashcat_ctx)
{ {
if (status_ctx->devices_status == STATUS_EXHAUSTED) if (status_ctx->devices_status == STATUS_EXHAUSTED)
{ {
const int rc_inner2_loop = inner2_loop (hashcat_ctx); if (inner2_loop (hashcat_ctx) == -1) myabort (hashcat_ctx);
if (rc_inner2_loop == -1) myabort (hashcat_ctx);
if (status_ctx->run_main_level3 == false) break; if (status_ctx->run_main_level3 == false) break;
} }
@ -406,9 +400,7 @@ static int inner1_loop (hashcat_ctx_t *hashcat_ctx)
{ {
straight_ctx->dicts_pos = dicts_pos; straight_ctx->dicts_pos = dicts_pos;
const int rc_inner2_loop = inner2_loop (hashcat_ctx); if (inner2_loop (hashcat_ctx) == -1) myabort (hashcat_ctx);
if (rc_inner2_loop == -1) myabort (hashcat_ctx);
if (status_ctx->run_main_level3 == false) break; if (status_ctx->run_main_level3 == false) break;
} }
@ -420,9 +412,7 @@ static int inner1_loop (hashcat_ctx_t *hashcat_ctx)
} }
else else
{ {
const int rc_inner2_loop = inner2_loop (hashcat_ctx); if (inner2_loop (hashcat_ctx) == -1) myabort (hashcat_ctx);
if (rc_inner2_loop == -1) myabort (hashcat_ctx);
} }
EVENT (EVENT_INNERLOOP2_FINISHED); EVENT (EVENT_INNERLOOP2_FINISHED);
@ -457,9 +447,7 @@ static int outer_loop (hashcat_ctx_t *hashcat_ctx)
* setup variables and buffers depending on hash_mode * setup variables and buffers depending on hash_mode
*/ */
const int rc_hashconfig = hashconfig_init (hashcat_ctx); if (hashconfig_init (hashcat_ctx) == -1)
if (rc_hashconfig == -1)
{ {
event_log_error (hashcat_ctx, "Invalid hash-mode '%u' selected.", user_options->hash_mode); event_log_error (hashcat_ctx, "Invalid hash-mode '%u' selected.", user_options->hash_mode);
@ -470,17 +458,13 @@ static int outer_loop (hashcat_ctx_t *hashcat_ctx)
* generate hashlist filename for later use * generate hashlist filename for later use
*/ */
const int rc_hashes_init_filename = hashes_init_filename (hashcat_ctx); if (hashes_init_filename (hashcat_ctx) == -1) return -1;
if (rc_hashes_init_filename == -1) return -1;
/** /**
* load hashes, stage 1 * load hashes, stage 1
*/ */
const int rc_hashes_init_stage1 = hashes_init_stage1 (hashcat_ctx); if (hashes_init_stage1 (hashcat_ctx) == -1) return -1;
if (rc_hashes_init_stage1 == -1) return -1;
if ((user_options->keyspace == false) && (user_options->stdout_flag == false)) if ((user_options->keyspace == false) && (user_options->stdout_flag == false))
{ {
@ -498,9 +482,7 @@ static int outer_loop (hashcat_ctx_t *hashcat_ctx)
hashes->hashes_cnt_orig = hashes->hashes_cnt; hashes->hashes_cnt_orig = hashes->hashes_cnt;
const int rc_hashes_init_stage2 = hashes_init_stage2 (hashcat_ctx); if (hashes_init_stage2 (hashcat_ctx) == -1) return -1;
if (rc_hashes_init_stage2 == -1) return -1;
/** /**
* potfile removes * potfile removes
@ -529,9 +511,7 @@ static int outer_loop (hashcat_ctx_t *hashcat_ctx)
* load hashes, stage 3, update cracked results from potfile * load hashes, stage 3, update cracked results from potfile
*/ */
const int rc_hashes_init_stage3 = hashes_init_stage3 (hashcat_ctx); if (hashes_init_stage3 (hashcat_ctx) == -1) return -1;
if (rc_hashes_init_stage3 == -1) return -1;
/** /**
* potfile show/left handling * potfile show/left handling
@ -543,9 +523,7 @@ static int outer_loop (hashcat_ctx_t *hashcat_ctx)
outfile_write_open (hashcat_ctx); outfile_write_open (hashcat_ctx);
const int rc = potfile_handle_show (hashcat_ctx); if (potfile_handle_show (hashcat_ctx) == -1) return -1;
if (rc == -1) return -1;
outfile_write_close (hashcat_ctx); outfile_write_close (hashcat_ctx);
@ -558,9 +536,7 @@ static int outer_loop (hashcat_ctx_t *hashcat_ctx)
outfile_write_open (hashcat_ctx); outfile_write_open (hashcat_ctx);
const int rc = potfile_handle_left (hashcat_ctx); if (potfile_handle_left (hashcat_ctx) == -1) return -1;
if (rc == -1) return -1;
outfile_write_close (hashcat_ctx); outfile_write_close (hashcat_ctx);
@ -610,25 +586,19 @@ static int outer_loop (hashcat_ctx_t *hashcat_ctx)
* load hashes, stage 4, automatic Optimizers * load hashes, stage 4, automatic Optimizers
*/ */
const int rc_hashes_init_stage4 = hashes_init_stage4 (hashcat_ctx); if (hashes_init_stage4 (hashcat_ctx) == -1) return -1;
if (rc_hashes_init_stage4 == -1) return -1;
/** /**
* load hashes, selftest * load hashes, selftest
*/ */
const int rc_hashes_init_selftest = hashes_init_selftest (hashcat_ctx); if (hashes_init_selftest (hashcat_ctx) == -1) return -1;
if (rc_hashes_init_selftest == -1) return -1;
/** /**
* load hashes, benchmark * load hashes, benchmark
*/ */
const int rc_hashes_init_benchmark = hashes_init_benchmark (hashcat_ctx); if (hashes_init_benchmark (hashcat_ctx) == -1) return -1;
if (rc_hashes_init_benchmark == -1) return -1;
/** /**
* Done loading hashes, log results * Done loading hashes, log results
@ -642,9 +612,7 @@ static int outer_loop (hashcat_ctx_t *hashcat_ctx)
EVENT (EVENT_BITMAP_INIT_PRE); EVENT (EVENT_BITMAP_INIT_PRE);
const int rc_bitmap_init = bitmap_ctx_init (hashcat_ctx); if (bitmap_ctx_init (hashcat_ctx) == -1) return -1;
if (rc_bitmap_init == -1) return -1;
EVENT (EVENT_BITMAP_INIT_POST); EVENT (EVENT_BITMAP_INIT_POST);
@ -658,33 +626,25 @@ static int outer_loop (hashcat_ctx_t *hashcat_ctx)
* Wordlist allocate buffer * Wordlist allocate buffer
*/ */
const int rc_wl_data_init = wl_data_init (hashcat_ctx); if (wl_data_init (hashcat_ctx) == -1) return -1;
if (rc_wl_data_init == -1) return -1;
/** /**
* straight mode init * straight mode init
*/ */
const int rc_straight_init = straight_ctx_init (hashcat_ctx); if (straight_ctx_init (hashcat_ctx) == -1) return -1;
if (rc_straight_init == -1) return -1;
/** /**
* straight mode init * straight mode init
*/ */
const int rc_combinator_init = combinator_ctx_init (hashcat_ctx); if (combinator_ctx_init (hashcat_ctx) == -1) return -1;
if (rc_combinator_init == -1) return -1;
/** /**
* charsets : keep them together for more easy maintainnce * charsets : keep them together for more easy maintainnce
*/ */
const int rc_mask_init = mask_ctx_init (hashcat_ctx); if (mask_ctx_init (hashcat_ctx) == -1) return -1;
if (rc_mask_init == -1) return -1;
/** /**
* prevent the user from using --skip/--limit together with maskfile and/or multiple word lists * prevent the user from using --skip/--limit together with maskfile and/or multiple word lists
@ -718,9 +678,7 @@ static int outer_loop (hashcat_ctx_t *hashcat_ctx)
* status progress init; needs hashes that's why we have to do it here and separate from status_ctx_init * status progress init; needs hashes that's why we have to do it here and separate from status_ctx_init
*/ */
const int rc_status_init = status_progress_init (hashcat_ctx); if (status_progress_init (hashcat_ctx) == -1) return -1;
if (rc_status_init == -1) return -1;
/** /**
* main screen * main screen
@ -740,9 +698,7 @@ static int outer_loop (hashcat_ctx_t *hashcat_ctx)
EVENT (EVENT_BACKEND_SESSION_PRE); EVENT (EVENT_BACKEND_SESSION_PRE);
const int rc_session_begin = backend_session_begin (hashcat_ctx); if (backend_session_begin (hashcat_ctx) == -1) return -1;
if (rc_session_begin == -1) return -1;
EVENT (EVENT_BACKEND_SESSION_POST); EVENT (EVENT_BACKEND_SESSION_POST);
@ -807,9 +763,7 @@ static int outer_loop (hashcat_ctx_t *hashcat_ctx)
* the weak hash check was removed maybe we can move this more to the bottom now * the weak hash check was removed maybe we can move this more to the bottom now
*/ */
const int rc_potfile_write = potfile_write_open (hashcat_ctx); if (potfile_write_open (hashcat_ctx) == -1) return -1;
if (rc_potfile_write == -1) return -1;
/** /**
* status and monitor threads * status and monitor threads
@ -861,9 +815,7 @@ static int outer_loop (hashcat_ctx_t *hashcat_ctx)
{ {
mask_ctx->masks_pos = masks_pos; mask_ctx->masks_pos = masks_pos;
const int rc_inner1_loop = inner1_loop (hashcat_ctx); if (inner1_loop (hashcat_ctx) == -1) myabort (hashcat_ctx);
if (rc_inner1_loop == -1) myabort (hashcat_ctx);
if (status_ctx->run_main_level2 == false) break; if (status_ctx->run_main_level2 == false) break;
} }
@ -875,9 +827,7 @@ static int outer_loop (hashcat_ctx_t *hashcat_ctx)
} }
else else
{ {
const int rc_inner1_loop = inner1_loop (hashcat_ctx); if (inner1_loop (hashcat_ctx) == -1) myabort (hashcat_ctx);
if (rc_inner1_loop == -1) myabort (hashcat_ctx);
} }
// wait for inner threads // wait for inner threads
@ -1012,41 +962,31 @@ int hashcat_session_init (hashcat_ctx_t *hashcat_ctx, const char *install_folder
* event init (needed for logging so should be first) * event init (needed for logging so should be first)
*/ */
const int rc_event_init = event_ctx_init (hashcat_ctx); if (event_ctx_init (hashcat_ctx) == -1) return -1;
if (rc_event_init == -1) return -1;
/** /**
* status init * status init
*/ */
const int rc_status_init = status_ctx_init (hashcat_ctx); if (status_ctx_init (hashcat_ctx) == -1) return -1;
if (rc_status_init == -1) return -1;
/** /**
* folder * folder
*/ */
const int rc_folder_config_init = folder_config_init (hashcat_ctx, install_folder, shared_folder); if (folder_config_init (hashcat_ctx, install_folder, shared_folder) == -1) return -1;
if (rc_folder_config_init == -1) return -1;
/** /**
* pidfile * pidfile
*/ */
const int rc_pidfile_init = pidfile_ctx_init (hashcat_ctx); if (pidfile_ctx_init (hashcat_ctx) == -1) return -1;
if (rc_pidfile_init == -1) return -1;
/** /**
* restore * restore
*/ */
const int rc_restore_init = restore_ctx_init (hashcat_ctx, argc, argv); if (restore_ctx_init (hashcat_ctx, argc, argv) == -1) return -1;
if (rc_restore_init == -1) return -1;
/** /**
* process user input * process user input
@ -1070,9 +1010,7 @@ int hashcat_session_init (hashcat_ctx_t *hashcat_ctx, const char *install_folder
WORD wVersionRequested = MAKEWORD (2,2); WORD wVersionRequested = MAKEWORD (2,2);
const int iResult = WSAStartup (wVersionRequested, &wsaData); if (WSAStartup (wVersionRequested, &wsaData) != NO_ERROR)
if (iResult != NO_ERROR)
{ {
fprintf (stderr, "WSAStartup: %s\n", strerror (errno)); fprintf (stderr, "WSAStartup: %s\n", strerror (errno));
@ -1086,17 +1024,13 @@ int hashcat_session_init (hashcat_ctx_t *hashcat_ctx, const char *install_folder
* logfile * logfile
*/ */
const int rc_logfile_init = logfile_init (hashcat_ctx); if (logfile_init (hashcat_ctx) == -1) return -1;
if (rc_logfile_init == -1) return -1;
/** /**
* cpu affinity * cpu affinity
*/ */
const int rc_affinity = set_cpu_affinity (hashcat_ctx); if (set_cpu_affinity (hashcat_ctx) == -1) return -1;
if (rc_affinity == -1) return -1;
/** /**
* prepare seeding for random number generator, required by logfile and rules generator * prepare seeding for random number generator, required by logfile and rules generator
@ -1116,33 +1050,25 @@ int hashcat_session_init (hashcat_ctx_t *hashcat_ctx, const char *install_folder
* tuning db * tuning db
*/ */
const int rc_tuning_db = tuning_db_init (hashcat_ctx); if (tuning_db_init (hashcat_ctx) == -1) return -1;
if (rc_tuning_db == -1) return -1;
/** /**
* induction directory * induction directory
*/ */
const int rc_induct_ctx_init = induct_ctx_init (hashcat_ctx); if (induct_ctx_init (hashcat_ctx) == -1) return -1;
if (rc_induct_ctx_init == -1) return -1;
/** /**
* outfile-check directory * outfile-check directory
*/ */
const int rc_outcheck_ctx_init = outcheck_ctx_init (hashcat_ctx); if (outcheck_ctx_init (hashcat_ctx) == -1) return -1;
if (rc_outcheck_ctx_init == -1) return -1;
/** /**
* outfile itself * outfile itself
*/ */
const int rc_outfile_init = outfile_init (hashcat_ctx); if (outfile_init (hashcat_ctx) == -1) return -1;
if (rc_outfile_init == -1) return -1;
/** /**
* potfile init * potfile init
@ -1150,65 +1076,49 @@ int hashcat_session_init (hashcat_ctx_t *hashcat_ctx, const char *install_folder
* plus it depends on hash_mode, so we continue using it in outer_loop * plus it depends on hash_mode, so we continue using it in outer_loop
*/ */
const int rc_potfile_init = potfile_init (hashcat_ctx); if (potfile_init (hashcat_ctx) == -1) return -1;
if (rc_potfile_init == -1) return -1;
/** /**
* dictstat init * dictstat init
*/ */
const int rc_dictstat_init = dictstat_init (hashcat_ctx); if (dictstat_init (hashcat_ctx) == -1) return -1;
if (rc_dictstat_init == -1) return -1;
/** /**
* loopback init * loopback init
*/ */
const int rc_loopback_init = loopback_init (hashcat_ctx); if (loopback_init (hashcat_ctx) == -1) return -1;
if (rc_loopback_init == -1) return -1;
/** /**
* debugfile init * debugfile init
*/ */
const int rc_debugfile_init = debugfile_init (hashcat_ctx); if (debugfile_init (hashcat_ctx) == -1) return -1;
if (rc_debugfile_init == -1) return -1;
/** /**
* Try to detect if all the files we're going to use are accessible in the mode we want them * Try to detect if all the files we're going to use are accessible in the mode we want them
*/ */
const int rc_user_options_check_files = user_options_check_files (hashcat_ctx); if (user_options_check_files (hashcat_ctx) == -1) return -1;
if (rc_user_options_check_files == -1) return -1;
/** /**
* Init backend library loader * Init backend library loader
*/ */
const int rc_backend_init = backend_ctx_init (hashcat_ctx); if (backend_ctx_init (hashcat_ctx) == -1) return -1;
if (rc_backend_init == -1) return -1;
/** /**
* Init backend devices * Init backend devices
*/ */
const int rc_devices_init = backend_ctx_devices_init (hashcat_ctx, comptime); if (backend_ctx_devices_init (hashcat_ctx, comptime) == -1) return -1;
if (rc_devices_init == -1) return -1;
/** /**
* HM devices: init * HM devices: init
*/ */
const int rc_hwmon_init = hwmon_ctx_init (hashcat_ctx); if (hwmon_ctx_init (hashcat_ctx) == -1) return -1;
if (rc_hwmon_init == -1) return -1;
// done // done
@ -1257,7 +1167,7 @@ int hashcat_session_execute (hashcat_ctx_t *hashcat_ctx)
} }
else else
{ {
int hash_mode; int hash_mode = 0;
while ((hash_mode = benchmark_next (hashcat_ctx)) != -1) while ((hash_mode = benchmark_next (hashcat_ctx)) != -1)
{ {
@ -1307,12 +1217,12 @@ int hashcat_session_execute (hashcat_ctx_t *hashcat_ctx)
if (rc_final == 0) if (rc_final == 0)
{ {
if (status_ctx->devices_status == STATUS_ABORTED_RUNTIME) rc_final = 4; 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_CHECKPOINT) rc_final = 3;
if (status_ctx->devices_status == STATUS_ABORTED) rc_final = 2; 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_QUIT) rc_final = 2;
if (status_ctx->devices_status == STATUS_EXHAUSTED) rc_final = 1; if (status_ctx->devices_status == STATUS_EXHAUSTED) rc_final = 1;
if (status_ctx->devices_status == STATUS_CRACKED) rc_final = 0; if (status_ctx->devices_status == STATUS_CRACKED) rc_final = 0;
if (status_ctx->devices_status == STATUS_ERROR) rc_final = -1; if (status_ctx->devices_status == STATUS_ERROR) rc_final = -1;
} }