mirror of
https://github.com/hashcat/hashcat.git
synced 2025-07-05 14:22:36 +00:00
Run through Clang's readability-else-after-return
There's no need for a return statement in an else path. Just take it out. Simplifies the code slightly.
This commit is contained in:
parent
6ecb42b3ea
commit
6dc72ebcc5
@ -4532,8 +4532,7 @@ int run_cracker (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, co
|
||||
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
double total_msec = device_param->speed_msec[0];
|
||||
|
||||
for (u32 speed_pos = 1; speed_pos < device_param->speed_pos; speed_pos++)
|
||||
@ -4572,7 +4571,6 @@ int run_cracker (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, co
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (device_param->speed_only_finish == true) break;
|
||||
|
||||
|
@ -57,8 +57,7 @@ int benchmark_next (hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
return hash_mode;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
char *modulefile = (char *) hcmalloc (HCBUFSIZ_TINY);
|
||||
|
||||
for (int i = cur; i < MODULE_HASH_MODES_MAXIMUM; i++)
|
||||
@ -78,7 +77,6 @@ int benchmark_next (hashcat_ctx_t *hashcat_ctx)
|
||||
}
|
||||
|
||||
hcfree (modulefile);
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
16
src/brain.c
16
src/brain.c
@ -1589,8 +1589,7 @@ bool brain_server_read_hash_dump (brain_server_db_hash_t *brain_server_db_hash,
|
||||
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
i64 temp_cnt = (u64) sb.st_size / sizeof (brain_server_hash_long_t);
|
||||
|
||||
if (brain_server_db_hash_realloc (brain_server_db_hash, temp_cnt) == false)
|
||||
@ -1617,7 +1616,6 @@ bool brain_server_read_hash_dump (brain_server_db_hash_t *brain_server_db_hash,
|
||||
brain_server_db_hash->write_hashes = false;
|
||||
|
||||
hc_fclose (&fp);
|
||||
}
|
||||
|
||||
const double ms = hc_timer_get (timer_dump);
|
||||
|
||||
@ -1644,8 +1642,7 @@ bool brain_server_write_hash_dump (brain_server_db_hash_t *brain_server_db_hash,
|
||||
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
const size_t nwrite = hc_fwrite (brain_server_db_hash->long_buf, sizeof (brain_server_hash_long_t), brain_server_db_hash->long_cnt, &fp);
|
||||
|
||||
if (nwrite != (size_t) brain_server_db_hash->long_cnt)
|
||||
@ -1660,7 +1657,6 @@ bool brain_server_write_hash_dump (brain_server_db_hash_t *brain_server_db_hash,
|
||||
hc_fclose (&fp);
|
||||
|
||||
brain_server_db_hash->write_hashes = false;
|
||||
}
|
||||
|
||||
// stats
|
||||
|
||||
@ -1790,8 +1786,7 @@ bool brain_server_read_attack_dump (brain_server_db_attack_t *brain_server_db_at
|
||||
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
i64 temp_cnt = (u64) sb.st_size / sizeof (brain_server_attack_long_t);
|
||||
|
||||
if (brain_server_db_attack_realloc (brain_server_db_attack, temp_cnt, 0) == false)
|
||||
@ -1818,7 +1813,6 @@ bool brain_server_read_attack_dump (brain_server_db_attack_t *brain_server_db_at
|
||||
brain_server_db_attack->write_attacks = false;
|
||||
|
||||
hc_fclose (&fp);
|
||||
}
|
||||
|
||||
const double ms = hc_timer_get (timer_dump);
|
||||
|
||||
@ -1845,8 +1839,7 @@ bool brain_server_write_attack_dump (brain_server_db_attack_t *brain_server_db_a
|
||||
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
// storing should not include reserved attacks only finished
|
||||
|
||||
const size_t nwrite = hc_fwrite (brain_server_db_attack->long_buf, sizeof (brain_server_attack_long_t), brain_server_db_attack->long_cnt, &fp);
|
||||
@ -1863,7 +1856,6 @@ bool brain_server_write_attack_dump (brain_server_db_attack_t *brain_server_db_a
|
||||
hc_fclose (&fp);
|
||||
|
||||
brain_server_db_attack->write_attacks = false;
|
||||
}
|
||||
|
||||
// stats
|
||||
|
||||
|
@ -576,13 +576,11 @@ int potfile_remove_parse (hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
// should be rejected?
|
||||
//const int parser_status = module_ctx->module_hash_decode_potfile (hashconfig, hash_buf.digest, hash_buf.salt, hash_buf.esalt, hash_buf.hook_salt, hash_buf.hash_info, line_hash_buf, line_hash_len, NULL);
|
||||
//if (parser_status != PARSER_OK) continue;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
const int parser_status = module_ctx->module_hash_decode (hashconfig, hash_buf.digest, hash_buf.salt, hash_buf.esalt, hash_buf.hook_salt, hash_buf.hash_info, line_hash_buf, line_hash_len);
|
||||
|
71
src/status.c
71
src/status.c
@ -327,14 +327,12 @@ char *status_get_hash_target (const hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
return tmp_buf2;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if (hashconfig->opts_type & OPTS_TYPE_BINARY_HASHFILE)
|
||||
{
|
||||
return hcstrdup (hashes->hashfile);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
char *tmp_buf = (char *) hcmalloc (HCBUFSIZ_LARGE);
|
||||
|
||||
const int tmp_len = hash_encode (hashcat_ctx->hashconfig, hashcat_ctx->hashes, hashcat_ctx->module_ctx, tmp_buf, HCBUFSIZ_LARGE, 0, 0);
|
||||
@ -349,13 +347,9 @@ char *status_get_hash_target (const hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
return tmp_buf2;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
return hcstrdup (hashes->hashfile);
|
||||
}
|
||||
}
|
||||
|
||||
int status_get_guess_mode (const hashcat_ctx_t *hashcat_ctx)
|
||||
{
|
||||
@ -389,31 +383,22 @@ int status_get_guess_mode (const hashcat_ctx_t *hashcat_ctx)
|
||||
{
|
||||
return GUESS_MODE_STRAIGHT_FILE_RULES_FILE;
|
||||
}
|
||||
else if (has_rule_gen == true)
|
||||
if (has_rule_gen == true)
|
||||
{
|
||||
return GUESS_MODE_STRAIGHT_FILE_RULES_GEN;
|
||||
}
|
||||
else
|
||||
{
|
||||
return GUESS_MODE_STRAIGHT_FILE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (has_rule_file == true)
|
||||
{
|
||||
return GUESS_MODE_STRAIGHT_STDIN_RULES_FILE;
|
||||
}
|
||||
else if (has_rule_gen == true)
|
||||
if (has_rule_gen == true)
|
||||
{
|
||||
return GUESS_MODE_STRAIGHT_STDIN_RULES_GEN;
|
||||
}
|
||||
else
|
||||
{
|
||||
return GUESS_MODE_STRAIGHT_STDIN;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (user_options->attack_mode == ATTACK_MODE_COMBI)
|
||||
{
|
||||
@ -421,11 +406,8 @@ int status_get_guess_mode (const hashcat_ctx_t *hashcat_ctx)
|
||||
{
|
||||
return GUESS_MODE_COMBINATOR_BASE_LEFT;
|
||||
}
|
||||
else
|
||||
{
|
||||
return GUESS_MODE_COMBINATOR_BASE_RIGHT;
|
||||
}
|
||||
}
|
||||
|
||||
if (user_options->attack_mode == ATTACK_MODE_BF)
|
||||
{
|
||||
@ -433,11 +415,8 @@ int status_get_guess_mode (const hashcat_ctx_t *hashcat_ctx)
|
||||
{
|
||||
return GUESS_MODE_MASK_CS;
|
||||
}
|
||||
else
|
||||
{
|
||||
return GUESS_MODE_MASK;
|
||||
}
|
||||
}
|
||||
|
||||
if (user_options->attack_mode == ATTACK_MODE_HYBRID1)
|
||||
{
|
||||
@ -445,11 +424,8 @@ int status_get_guess_mode (const hashcat_ctx_t *hashcat_ctx)
|
||||
{
|
||||
return GUESS_MODE_HYBRID1_CS;
|
||||
}
|
||||
else
|
||||
{
|
||||
return GUESS_MODE_HYBRID1;
|
||||
}
|
||||
}
|
||||
|
||||
if (user_options->attack_mode == ATTACK_MODE_HYBRID2)
|
||||
{
|
||||
@ -457,11 +433,8 @@ int status_get_guess_mode (const hashcat_ctx_t *hashcat_ctx)
|
||||
{
|
||||
return GUESS_MODE_HYBRID2_CS;
|
||||
}
|
||||
else
|
||||
{
|
||||
return GUESS_MODE_HYBRID2;
|
||||
}
|
||||
}
|
||||
|
||||
return GUESS_MODE_NONE;
|
||||
}
|
||||
@ -490,11 +463,8 @@ char *status_get_guess_base (const hashcat_ctx_t *hashcat_ctx)
|
||||
{
|
||||
return strdup (combinator_ctx->dict1);
|
||||
}
|
||||
else
|
||||
{
|
||||
return strdup (combinator_ctx->dict2);
|
||||
}
|
||||
}
|
||||
|
||||
if (user_options->attack_mode == ATTACK_MODE_BF)
|
||||
{
|
||||
@ -518,14 +488,11 @@ char *status_get_guess_base (const hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
return strdup (mask_ctx->mask);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
const straight_ctx_t *straight_ctx = hashcat_ctx->straight_ctx;
|
||||
|
||||
return strdup (straight_ctx->dict);
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -568,13 +535,11 @@ int status_get_guess_base_offset (const hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
return mask_ctx->masks_pos + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
const straight_ctx_t *straight_ctx = hashcat_ctx->straight_ctx;
|
||||
|
||||
return straight_ctx->dicts_pos + 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -618,13 +583,11 @@ int status_get_guess_base_count (const hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
return mask_ctx->masks_cnt;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
const straight_ctx_t *straight_ctx = hashcat_ctx->straight_ctx;
|
||||
|
||||
return straight_ctx->dicts_cnt;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -657,11 +620,8 @@ char *status_get_guess_mod (const hashcat_ctx_t *hashcat_ctx)
|
||||
{
|
||||
return strdup (combinator_ctx->dict2);
|
||||
}
|
||||
else
|
||||
{
|
||||
return strdup (combinator_ctx->dict1);
|
||||
}
|
||||
}
|
||||
|
||||
if (user_options->attack_mode == ATTACK_MODE_BF)
|
||||
{
|
||||
@ -683,13 +643,11 @@ char *status_get_guess_mod (const hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
return strdup (straight_ctx->dict);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
const mask_ctx_t *mask_ctx = hashcat_ctx->mask_ctx;
|
||||
|
||||
return strdup (mask_ctx->mask);
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@ -729,13 +687,11 @@ int status_get_guess_mod_offset (const hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
return straight_ctx->dicts_pos + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
const mask_ctx_t *mask_ctx = hashcat_ctx->mask_ctx;
|
||||
|
||||
return mask_ctx->masks_pos + 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -775,13 +731,11 @@ int status_get_guess_mod_count (const hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
return straight_ctx->dicts_cnt;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
const mask_ctx_t *mask_ctx = hashcat_ctx->mask_ctx;
|
||||
|
||||
return mask_ctx->masks_cnt;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -1196,11 +1150,8 @@ int status_get_progress_mode (const hashcat_ctx_t *hashcat_ctx)
|
||||
{
|
||||
return PROGRESS_MODE_KEYSPACE_KNOWN;
|
||||
}
|
||||
else
|
||||
{
|
||||
return PROGRESS_MODE_KEYSPACE_UNKNOWN;
|
||||
}
|
||||
}
|
||||
|
||||
double status_get_progress_finished_percent (const hashcat_ctx_t *hashcat_ctx)
|
||||
{
|
||||
|
@ -1909,8 +1909,7 @@ u64 user_options_extra_amplifier (hashcat_ctx_t *hashcat_ctx)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if (user_options_extra->attack_kern == ATTACK_KERN_STRAIGHT)
|
||||
{
|
||||
if (straight_ctx->kernel_rules_cnt)
|
||||
@ -1932,7 +1931,6 @@ u64 user_options_extra_amplifier (hashcat_ctx_t *hashcat_ctx)
|
||||
return mask_ctx->bfs_cnt;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user