1
mirror of https://github.com/hashcat/hashcat synced 2024-12-01 20:18:12 +01:00

updated output messages for identify functionality

This commit is contained in:
Gabriele Gristina 2021-06-11 20:12:59 +02:00
parent 340e8d1033
commit a25db47215

View File

@ -1464,21 +1464,31 @@ int hashcat_session_execute (hashcat_ctx_t *hashcat_ctx)
if (modes_cnt > 1)
{
event_log_info (hashcat_ctx, "The following %d hash-modes match the structure of your input hash:", modes_cnt);
event_log_info (hashcat_ctx, NULL);
event_log_info (hashcat_ctx, " # | Name | Category");
event_log_info (hashcat_ctx, " ======+=====================================================+======================================");
if (user_options->quiet == false)
{
event_log_info (hashcat_ctx, "The following %d hash-modes match the structure of your input hash:", modes_cnt);
event_log_info (hashcat_ctx, NULL);
event_log_info (hashcat_ctx, " # | Name | Category");
event_log_info (hashcat_ctx, " ======+=====================================================+======================================");
}
for (int i = 0; i < modes_cnt; i++)
{
event_log_info (hashcat_ctx, "%7u | %-51s | %s", usage_sort_buf[i].hash_mode, usage_sort_buf[i].hash_name, strhashcategory (usage_sort_buf[i].hash_category));
if (user_options->quiet == false)
{
event_log_info (hashcat_ctx, "%7u | %-51s | %s", usage_sort_buf[i].hash_mode, usage_sort_buf[i].hash_name, strhashcategory (usage_sort_buf[i].hash_category));
}
else
{
event_log_info (hashcat_ctx, "%u", usage_sort_buf[i].hash_mode);
}
hcfree (usage_sort_buf[i].hash_name);
}
hcfree (usage_sort_buf);
event_log_info (hashcat_ctx, NULL);
if (user_options->quiet == false) event_log_info (hashcat_ctx, NULL);
if (user_options->identify == false)
{
@ -1492,12 +1502,39 @@ int hashcat_session_execute (hashcat_ctx_t *hashcat_ctx)
// modes_cnt == 1
event_log_warning (hashcat_ctx, "Hash-mode was not specified with -m. Attempting to auto-detect hash mode.");
event_log_warning (hashcat_ctx, "The following mode was auto-detected as the only one matching your input hash:");
event_log_warning (hashcat_ctx, "\n%u | %s | %s\n", usage_sort_buf[0].hash_mode, usage_sort_buf[0].hash_name, strhashcategory (usage_sort_buf[0].hash_category));
event_log_warning (hashcat_ctx, "NOTE: Auto-detect is best effort. The correct hash-mode is NOT guaranteed!");
event_log_warning (hashcat_ctx, "Do NOT report auto-detect issues unless you are certain of the hash type.");
event_log_warning (hashcat_ctx, NULL);
if (user_options->identify == false)
{
event_log_warning (hashcat_ctx, "Hash-mode was not specified with -m. Attempting to auto-detect hash mode.");
event_log_warning (hashcat_ctx, "The following mode was auto-detected as the only one matching your input hash:");
}
if (user_options->identify == true)
{
if (user_options->quiet == true)
{
event_log_info (hashcat_ctx, "%u", usage_sort_buf[0].hash_mode);
}
else
{
event_log_info (hashcat_ctx, "The following hash-mode match the structure of your input hash:");
event_log_info (hashcat_ctx, NULL);
event_log_info (hashcat_ctx, " # | Name | Category");
event_log_info (hashcat_ctx, " ======+=====================================================+======================================");
event_log_info (hashcat_ctx, "%7u | %-51s | %s", usage_sort_buf[0].hash_mode, usage_sort_buf[0].hash_name, strhashcategory (usage_sort_buf[0].hash_category));
event_log_info (hashcat_ctx, NULL);
}
}
else
{
event_log_info (hashcat_ctx, "\n%u | %s | %s\n", usage_sort_buf[0].hash_mode, usage_sort_buf[0].hash_name, strhashcategory (usage_sort_buf[0].hash_category));
}
if (user_options->identify == false)
{
event_log_warning (hashcat_ctx, "NOTE: Auto-detect is best effort. The correct hash-mode is NOT guaranteed!");
event_log_warning (hashcat_ctx, "Do NOT report auto-detect issues unless you are certain of the hash type.");
event_log_warning (hashcat_ctx, NULL);
}
user_options->hash_mode = usage_sort_buf[0].hash_mode;