Merge pull request #3710 from matrix/help2int

Help: show supported hash-modes only with -hh
pull/3719/head^2
Jens Steube 12 months ago committed by GitHub
commit bf1d7d0789
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -87,6 +87,7 @@
- SecureCRT MasterPassphrase v2: update module, pure kernels and test unit. Add optimized kernels.
- Metal Backend: added workaround to prevent 'Infinite Loop' bug when build kernels
- User Options: added --metal-compiler-runtime option
- Help: show supported hash-modes only with -hh
* changes v6.2.5 -> v6.2.6

@ -715,7 +715,7 @@ typedef enum user_options_defaults
STATUS_TIMER = 10,
STDIN_TIMEOUT_ABORT = 120,
STDOUT_FLAG = false,
USAGE = false,
USAGE = 0,
USERNAME = false,
VERSION = false,
VERACRYPT_PIM_START = 485,
@ -2366,7 +2366,6 @@ typedef struct user_options
bool status_json;
bool stdout_flag;
bool stdin_timeout_abort_chgd;
bool usage;
bool username;
bool veracrypt_pim_start_chgd;
bool veracrypt_pim_stop_chgd;
@ -2443,6 +2442,7 @@ typedef struct user_options
u32 segment_size;
u32 status_timer;
u32 stdin_timeout_abort;
u32 usage;
u32 veracrypt_pim_start;
u32 veracrypt_pim_stop;
u32 workload_profile;

@ -4254,11 +4254,12 @@ int backend_ctx_init (hashcat_ctx_t *hashcat_ctx)
backend_ctx->enabled = false;
if (user_options->usage > 0) return 0;
if (user_options->hash_info == true) return 0;
if (user_options->keyspace == true) return 0;
if (user_options->left == true) return 0;
if (user_options->show == true) return 0;
if (user_options->usage == true) return 0;
if (user_options->version == true) return 0;
if (user_options->identify == true) return 0;

@ -79,14 +79,15 @@ int bitmap_ctx_init (hashcat_ctx_t *hashcat_ctx)
bitmap_ctx->enabled = false;
if (user_options->usage > 0) return 0;
if (user_options->backend_info > 0) return 0;
if (user_options->hash_info == true) return 0;
if (user_options->keyspace == true) return 0;
if (user_options->left == true) return 0;
if (user_options->show == true) return 0;
if (user_options->usage == true) return 0;
if (user_options->version == true) return 0;
if (user_options->identify == true) return 0;
if (user_options->backend_info > 0) return 0;
bitmap_ctx->enabled = true;

@ -19,12 +19,13 @@ int combinator_ctx_init (hashcat_ctx_t *hashcat_ctx)
combinator_ctx->enabled = false;
if (user_options->usage > 0) return 0;
if (user_options->backend_info > 0) return 0;
if (user_options->hash_info == true) return 0;
if (user_options->left == true) return 0;
if (user_options->show == true) return 0;
if (user_options->usage == true) return 0;
if (user_options->version == true) return 0;
if (user_options->backend_info > 0) return 0;
if ((user_options->attack_mode != ATTACK_MODE_COMBI)
&& (user_options->attack_mode != ATTACK_MODE_HYBRID1)

@ -15,14 +15,15 @@ int cpt_ctx_init (hashcat_ctx_t *hashcat_ctx)
cpt_ctx->enabled = false;
if (user_options->usage > 0) return 0;
if (user_options->backend_info > 0) return 0;
if (user_options->hash_info == true) return 0;
if (user_options->keyspace == true) return 0;
if (user_options->left == true) return 0;
if (user_options->show == true) return 0;
if (user_options->usage == true) return 0;
if (user_options->version == true) return 0;
if (user_options->identify == true) return 0;
if (user_options->backend_info > 0) return 0;
cpt_ctx->enabled = true;

@ -114,6 +114,11 @@ int debugfile_init (hashcat_ctx_t *hashcat_ctx)
debugfile_ctx->enabled = false;
if (user_options->debug_mode == 0) return 0;
if (user_options->usage > 0) return 0;
if (user_options->backend_info > 0) return 0;
if (user_options->benchmark == true) return 0;
if (user_options->hash_info == true) return 0;
if (user_options->keyspace == true) return 0;
@ -122,11 +127,8 @@ int debugfile_init (hashcat_ctx_t *hashcat_ctx)
if (user_options->stdout_flag == true) return 0;
if (user_options->speed_only == true) return 0;
if (user_options->progress_only == true) return 0;
if (user_options->usage == true) return 0;
if (user_options->version == true) return 0;
if (user_options->identify == true) return 0;
if (user_options->debug_mode == 0) return 0;
if (user_options->backend_info > 0) return 0;
debugfile_ctx->enabled = true;

@ -56,21 +56,22 @@ int dictstat_init (hashcat_ctx_t *hashcat_ctx)
dictstat_ctx->enabled = false;
if (user_options->usage > 0) return 0;
if (user_options->backend_info > 0) return 0;
if (user_options->benchmark == true) return 0;
if (user_options->hash_info == true) return 0;
if (user_options->keyspace == true) return 0;
if (user_options->left == true) return 0;
if (user_options->show == true) return 0;
if (user_options->usage == true) return 0;
if (user_options->version == true) return 0;
if (user_options->identify == true) return 0;
if (user_options->backend_info > 0) return 0;
if (user_options->attack_mode == ATTACK_MODE_BF) return 0;
dictstat_ctx->enabled = true;
dictstat_ctx->base = (dictstat_t *) hccalloc (MAX_DICTSTAT, sizeof (dictstat_t));
dictstat_ctx->cnt = 0;
dictstat_ctx->enabled = true;
dictstat_ctx->base = (dictstat_t *) hccalloc (MAX_DICTSTAT, sizeof (dictstat_t));
dictstat_ctx->cnt = 0;
hc_asprintf (&dictstat_ctx->filename, "%s/%s", folder_config->profile_dir, DICTSTAT_FILENAME);

@ -1226,16 +1226,17 @@ int hwmon_ctx_init (hashcat_ctx_t *hashcat_ctx)
return 0;
#endif // WITH_HWMON
if (user_options->usage > 0) return 0;
if (user_options->backend_info > 0) return 0;
if (user_options->hash_info == true) return 0;
if (user_options->keyspace == true) return 0;
if (user_options->left == true) return 0;
if (user_options->show == true) return 0;
if (user_options->stdout_flag == true) return 0;
if (user_options->usage == true) return 0;
if (user_options->version == true) return 0;
if (user_options->identify == true) return 0;
if (user_options->hwmon_disable == true) return 0;
if (user_options->backend_info > 0) return 0;
hwmon_ctx->hm_device = (hm_attrs_t *) hccalloc (DEVICES_MAX, sizeof (hm_attrs_t));

@ -39,6 +39,9 @@ int induct_ctx_init (hashcat_ctx_t *hashcat_ctx)
induct_ctx->enabled = false;
if (user_options->usage > 0) return 0;
if (user_options->backend_info > 0) return 0;
if (user_options->benchmark == true) return 0;
if (user_options->hash_info == true) return 0;
if (user_options->keyspace == true) return 0;
@ -47,10 +50,8 @@ int induct_ctx_init (hashcat_ctx_t *hashcat_ctx)
if (user_options->stdout_flag == true) return 0;
if (user_options->speed_only == true) return 0;
if (user_options->progress_only == true) return 0;
if (user_options->usage == true) return 0;
if (user_options->version == true) return 0;
if (user_options->identify == true) return 0;
if (user_options->backend_info > 0) return 0;
if ((user_options->attack_mode != ATTACK_MODE_STRAIGHT)
&& (user_options->attack_mode != ATTACK_MODE_ASSOCIATION)) return 0;

@ -60,6 +60,9 @@ int loopback_init (hashcat_ctx_t *hashcat_ctx)
loopback_ctx->enabled = false;
if (user_options->usage > 0) return 0;
if (user_options->backend_info > 0) return 0;
if (user_options->benchmark == true) return 0;
if (user_options->hash_info == true) return 0;
if (user_options->keyspace == true) return 0;
@ -68,10 +71,8 @@ int loopback_init (hashcat_ctx_t *hashcat_ctx)
if (user_options->stdout_flag == true) return 0;
if (user_options->speed_only == true) return 0;
if (user_options->progress_only == true) return 0;
if (user_options->usage == true) return 0;
if (user_options->version == true) return 0;
if (user_options->identify == true) return 0;
if (user_options->backend_info > 0) return 0;
loopback_ctx->enabled = true;
loopback_ctx->fp.pfp = NULL;

@ -1312,7 +1312,7 @@ int main (int argc, char **argv)
if (hashcat_session_init (hashcat_ctx, install_folder, shared_folder, argc, argv, COMPTIME) == 0)
{
if (user_options->usage == true)
if (user_options->usage > 0)
{
usage_big_print (hashcat_ctx);

@ -1401,12 +1401,13 @@ int mask_ctx_init (hashcat_ctx_t *hashcat_ctx)
mask_ctx->enabled = false;
if (user_options->usage > 0) return 0;
if (user_options->backend_info > 0) return 0;
if (user_options->hash_info == true) return 0;
if (user_options->left == true) return 0;
if (user_options->show == true) return 0;
if (user_options->usage == true) return 0;
if (user_options->version == true) return 0;
if (user_options->backend_info > 0) return 0;
if (user_options->attack_mode == ATTACK_MODE_ASSOCIATION) return 0;
if (user_options->attack_mode == ATTACK_MODE_STRAIGHT) return 0;

@ -110,17 +110,18 @@ int potfile_init (hashcat_ctx_t *hashcat_ctx)
potfile_ctx->enabled = false;
if (user_options->usage > 0) return 0;
if (user_options->backend_info > 0) return 0;
if (user_options->benchmark == true) return 0;
if (user_options->hash_info == true) return 0;
if (user_options->keyspace == true) return 0;
if (user_options->stdout_flag == true) return 0;
if (user_options->speed_only == true) return 0;
if (user_options->progress_only == true) return 0;
if (user_options->usage == true) return 0;
if (user_options->version == true) return 0;
if (user_options->identify == true) return 0;
if (user_options->potfile_disable == true) return 0;
if (user_options->backend_info > 0) return 0;
if (hashconfig->potfile_disable == true) return 0;

@ -302,6 +302,9 @@ int restore_ctx_init (hashcat_ctx_t *hashcat_ctx, int argc, char **argv)
restore_ctx->enabled = false;
if (user_options->usage > 0) return 0;
if (user_options->backend_info > 0) return 0;
if (user_options->benchmark == true) return 0;
if (user_options->hash_info == true) return 0;
if (user_options->keyspace == true) return 0;
@ -310,11 +313,9 @@ int restore_ctx_init (hashcat_ctx_t *hashcat_ctx, int argc, char **argv)
if (user_options->stdout_flag == true) return 0;
if (user_options->speed_only == true) return 0;
if (user_options->progress_only == true) return 0;
if (user_options->usage == true) return 0;
if (user_options->version == true) return 0;
if (user_options->identify == true) return 0;
if (user_options->restore_disable == true) return 0;
if (user_options->backend_info > 0) return 0;
if (argc == 0) return 0;
if (argv == NULL) return 0;

@ -262,12 +262,13 @@ int straight_ctx_init (hashcat_ctx_t *hashcat_ctx)
straight_ctx->enabled = false;
if (user_options->usage > 0) return 0;
if (user_options->backend_info > 0) return 0;
if (user_options->left == true) return 0;
if (user_options->show == true) return 0;
if (user_options->usage == true) return 0;
if (user_options->version == true) return 0;
if (user_options->hash_info == true) return 0;
if (user_options->backend_info > 0) return 0;
if (user_options->attack_mode == ATTACK_MODE_BF) return 0;

@ -35,7 +35,7 @@ void welcome_screen (hashcat_ctx_t *hashcat_ctx, const char *version_tag)
if (user_options->left == true) return;
if (user_options->identify == true) return;
if (user_options->usage == true)
if (user_options->usage > 0)
{
event_log_info (hashcat_ctx, "%s (%s) starting in help mode", PROGNAME, version_tag);
event_log_info (hashcat_ctx, NULL);

@ -54,14 +54,15 @@ int tuning_db_init (hashcat_ctx_t *hashcat_ctx)
tuning_db->enabled = false;
if (user_options->usage > 0) return 0;
if (user_options->backend_info > 0) return 0;
if (user_options->hash_info == true) return 0;
if (user_options->keyspace == true) return 0;
if (user_options->left == true) return 0;
if (user_options->show == true) return 0;
if (user_options->usage == true) return 0;
if (user_options->version == true) return 0;
if (user_options->identify == true) return 0;
if (user_options->backend_info > 0) return 0;
tuning_db->enabled = true;

@ -29,7 +29,7 @@ static const char *const USAGE_BIG_PRE_HASHMODES[] =
" -m, --hash-type | Num | Hash-type, references below (otherwise autodetect) | -m 1000",
" -a, --attack-mode | Num | Attack-mode, see references below | -a 3",
" -V, --version | | Print version |",
" -h, --help | | Print help |",
" -h, --help | | Print help. Use -hh to show all supported hash-modes | -h or -hh",
" --quiet | | Suppress output |",
" --hex-charset | | Assume charset is given in hex |",
" --hex-salt | | Assume salt is given in hex |",
@ -145,13 +145,28 @@ static const char *const USAGE_BIG_PRE_HASHMODES[] =
" --brain-session-whitelist | Hex | Allow given sessions only, separated with commas | --brain-session-whitelist=0x2ae611db",
#endif
"",
"- [ Hash modes ] -",
NULL
};
static const char *const USAGE_BIG_HEADER_HASHMODES[] =
{
"- [ Hash Modes ] -",
"",
" # | Name | Category",
" ======+============================================================+======================================",
NULL
};
static const char *const USAGE_BIG_NO_HASHMODES[] =
{
"- [ Hash Modes ] -",
"",
" please use -hh to show all supported Hash Modes"
"",
"",
NULL
};
static const char *const USAGE_BIG_POST_HASHMODES[] =
{
#ifdef WITH_BRAIN
@ -306,37 +321,42 @@ void usage_big_print (hashcat_ctx_t *hashcat_ctx)
const hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
user_options_t *user_options = hashcat_ctx->user_options;
char *modulefile = (char *) hcmalloc (HCBUFSIZ_TINY);
usage_sort_t *usage_sort_buf = (usage_sort_t *) hccalloc (MODULE_HASH_MODES_MAXIMUM, sizeof (usage_sort_t));
int usage_sort_cnt = 0;
for (int i = 0; i < MODULE_HASH_MODES_MAXIMUM; i++)
usage_sort_t *usage_sort_buf = NULL;
if (user_options->usage > 1)
{
user_options->hash_mode = i;
char *modulefile = (char *) hcmalloc (HCBUFSIZ_TINY);
module_filename (folder_config, i, modulefile, HCBUFSIZ_TINY);
usage_sort_buf = (usage_sort_t *) hccalloc (MODULE_HASH_MODES_MAXIMUM, sizeof (usage_sort_t));
if (hc_path_exist (modulefile) == false) continue;
for (int i = 0; i < MODULE_HASH_MODES_MAXIMUM; i++)
{
user_options->hash_mode = i;
const int rc = hashconfig_init (hashcat_ctx);
module_filename (folder_config, i, modulefile, HCBUFSIZ_TINY);
if (rc == 0)
{
usage_sort_buf[usage_sort_cnt].hash_mode = hashconfig->hash_mode;
usage_sort_buf[usage_sort_cnt].hash_name = hcstrdup (hashconfig->hash_name);
usage_sort_buf[usage_sort_cnt].hash_category = hashconfig->hash_category;
if (hc_path_exist (modulefile) == false) continue;
usage_sort_cnt++;
}
const int rc = hashconfig_init (hashcat_ctx);
hashconfig_destroy (hashcat_ctx);
}
if (rc == 0)
{
usage_sort_buf[usage_sort_cnt].hash_mode = hashconfig->hash_mode;
usage_sort_buf[usage_sort_cnt].hash_name = hcstrdup (hashconfig->hash_name);
usage_sort_buf[usage_sort_cnt].hash_category = hashconfig->hash_category;
usage_sort_cnt++;
}
hcfree (modulefile);
hashconfig_destroy (hashcat_ctx);
}
hcfree (modulefile);
qsort (usage_sort_buf, usage_sort_cnt, sizeof (usage_sort_t), sort_by_usage);
qsort (usage_sort_buf, usage_sort_cnt, sizeof (usage_sort_t), sort_by_usage);
}
for (int i = 0; USAGE_BIG_PRE_HASHMODES[i] != NULL; i++)
{
@ -347,21 +367,40 @@ void usage_big_print (hashcat_ctx_t *hashcat_ctx)
//hc_fwrite (EOL, strlen (EOL), 1, stdout);
for (int i = 0; i < usage_sort_cnt; i++)
if (user_options->usage > 1)
{
printf ("%7u | %-58s | %s", usage_sort_buf[i].hash_mode, usage_sort_buf[i].hash_name, strhashcategory (usage_sort_buf[i].hash_category));
for (int i = 0; USAGE_BIG_HEADER_HASHMODES[i] != NULL; i++)
{
printf ("%s", USAGE_BIG_HEADER_HASHMODES[i]);
fwrite (EOL, strlen (EOL), 1, stdout);
}
for (int i = 0; i < usage_sort_cnt; i++)
{
printf ("%7u | %-58s | %s", usage_sort_buf[i].hash_mode, usage_sort_buf[i].hash_name, strhashcategory (usage_sort_buf[i].hash_category));
fwrite (EOL, strlen (EOL), 1, stdout);
}
fwrite (EOL, strlen (EOL), 1, stdout);
}
fwrite (EOL, strlen (EOL), 1, stdout);
for (int i = 0; i < usage_sort_cnt; i++)
{
hcfree (usage_sort_buf[i].hash_name);
}
for (int i = 0; i < usage_sort_cnt; i++)
{
hcfree (usage_sort_buf[i].hash_name);
hcfree (usage_sort_buf);
}
else
{
for (int i = 0; USAGE_BIG_NO_HASHMODES[i] != NULL; i++)
{
printf ("%s", USAGE_BIG_NO_HASHMODES[i]);
hcfree (usage_sort_buf);
fwrite (EOL, strlen (EOL), 1, stdout);
}
}
for (int i = 0; USAGE_BIG_POST_HASHMODES[i] != NULL; i++)
{

@ -390,7 +390,7 @@ int user_options_getopt (hashcat_ctx_t *hashcat_ctx, int argc, char **argv)
{
switch (c)
{
case IDX_HELP: user_options->usage = true; break;
case IDX_HELP: user_options->usage++; break;
case IDX_VERSION: user_options->version = true; break;
case IDX_RESTORE: user_options->restore = true; break;
case IDX_QUIET: user_options->quiet = true; break;
@ -568,6 +568,13 @@ int user_options_sanity (hashcat_ctx_t *hashcat_ctx)
return -1;
}
if (user_options->usage > 2)
{
event_log_error (hashcat_ctx, "Invalid --help/-h value, must have a value greater or equal to 0 and lower than 3.");
return -1;
}
#ifdef WITH_BRAIN
if ((user_options->brain_client == true) && (user_options->brain_server == true))
{
@ -1514,7 +1521,7 @@ int user_options_sanity (hashcat_ctx_t *hashcat_ctx)
{
show_error = false;
}
else if (user_options->usage == true)
else if (user_options->usage > 0)
{
show_error = false;
}
@ -1734,7 +1741,7 @@ void user_options_session_auto (hashcat_ctx_t *hashcat_ctx)
user_options->session = "hash_info";
}
if (user_options->usage == true)
if (user_options->usage > 0)
{
user_options->session = "usage";
}
@ -1817,7 +1824,7 @@ void user_options_preprocess (hashcat_ctx_t *hashcat_ctx)
|| user_options->speed_only == true
|| user_options->progress_only == true
|| user_options->identify == true
|| user_options->usage == true
|| user_options->usage > 0
|| user_options->backend_info > 0)
{
user_options->hwmon_disable = true;
@ -1874,7 +1881,7 @@ void user_options_preprocess (hashcat_ctx_t *hashcat_ctx)
user_options->quiet = true;
}
if (user_options->usage == true)
if (user_options->usage > 0)
{
user_options->quiet = true;
}

@ -695,20 +695,21 @@ int wl_data_init (hashcat_ctx_t *hashcat_ctx)
wl_data->enabled = false;
if (user_options->usage > 0) return 0;
if (user_options->backend_info > 0) return 0;
if (user_options->benchmark == true) return 0;
if (user_options->hash_info == true) return 0;
if (user_options->left == true) return 0;
if (user_options->usage == true) return 0;
if (user_options->version == true) return 0;
if (user_options->backend_info > 0) return 0;
wl_data->enabled = true;
wl_data->buf = (char *) hcmalloc (user_options->segment_size);
wl_data->avail = user_options->segment_size;
wl_data->incr = user_options->segment_size;
wl_data->cnt = 0;
wl_data->pos = 0;
wl_data->buf = (char *) hcmalloc (user_options->segment_size);
wl_data->avail = user_options->segment_size;
wl_data->incr = user_options->segment_size;
wl_data->cnt = 0;
wl_data->pos = 0;
/**
* choose dictionary parser

Loading…
Cancel
Save