mirror of
https://github.com/hashcat/hashcat.git
synced 2025-03-06 18:16:12 +00:00
color cracked hash as an option
This commit is contained in:
parent
9e4e7c1c60
commit
c1459cd2d6
@ -636,6 +636,9 @@ typedef enum user_options_defaults
|
|||||||
BRAIN_SERVER = false,
|
BRAIN_SERVER = false,
|
||||||
BRAIN_SESSION = 0,
|
BRAIN_SESSION = 0,
|
||||||
#endif
|
#endif
|
||||||
|
#if !defined(_WIN)
|
||||||
|
COLOR = false,
|
||||||
|
#endif
|
||||||
DEBUG_MODE = 0,
|
DEBUG_MODE = 0,
|
||||||
DEPRECATED_CHECK = true,
|
DEPRECATED_CHECK = true,
|
||||||
DYNAMIC_X = false,
|
DYNAMIC_X = false,
|
||||||
@ -750,6 +753,9 @@ typedef enum user_options_map
|
|||||||
IDX_BRAIN_SESSION = 0xff0f,
|
IDX_BRAIN_SESSION = 0xff0f,
|
||||||
IDX_BRAIN_SESSION_WHITELIST = 0xff10,
|
IDX_BRAIN_SESSION_WHITELIST = 0xff10,
|
||||||
#endif
|
#endif
|
||||||
|
#if !defined(_WIN)
|
||||||
|
IDX_COLOR = 0xff56,
|
||||||
|
#endif
|
||||||
IDX_CPU_AFFINITY = 0xff11,
|
IDX_CPU_AFFINITY = 0xff11,
|
||||||
IDX_CUSTOM_CHARSET_1 = '1',
|
IDX_CUSTOM_CHARSET_1 = '1',
|
||||||
IDX_CUSTOM_CHARSET_2 = '2',
|
IDX_CUSTOM_CHARSET_2 = '2',
|
||||||
@ -2340,6 +2346,9 @@ typedef struct user_options
|
|||||||
bool brain_client;
|
bool brain_client;
|
||||||
bool brain_server;
|
bool brain_server;
|
||||||
#endif
|
#endif
|
||||||
|
#if !defined(_WIN)
|
||||||
|
bool color;
|
||||||
|
#endif
|
||||||
bool force;
|
bool force;
|
||||||
bool deprecated_check;
|
bool deprecated_check;
|
||||||
bool dynamic_x;
|
bool dynamic_x;
|
||||||
|
11
src/main.c
11
src/main.c
@ -352,16 +352,11 @@ static void main_cracker_hash_cracked (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx,
|
|||||||
if (outfile_ctx->filename == NULL) if (user_options->quiet == false) clear_prompt (hashcat_ctx);
|
if (outfile_ctx->filename == NULL) if (user_options->quiet == false) clear_prompt (hashcat_ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined (_WIN)
|
// cyan color for cracked hashes
|
||||||
|
if (user_options->color == true) fputs("\033[0;36m", stdout);
|
||||||
fwrite (buf, len, 1, stdout);
|
fwrite (buf, len, 1, stdout);
|
||||||
|
if (user_options->color == true) fwrite("\033[0m", 4, 1, stdout);
|
||||||
fwrite (EOL, strlen (EOL), 1, stdout);
|
fwrite (EOL, strlen (EOL), 1, stdout);
|
||||||
#else
|
|
||||||
// make cracked hash output in cyan
|
|
||||||
fputs("\033[36m", stdout);
|
|
||||||
fwrite (buf, len, 1, stdout);
|
|
||||||
fwrite("\033[0m", 4, 1, stdout);
|
|
||||||
fwrite (EOL, strlen (EOL), 1, stdout);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if ((user_options_extra->wordlist_mode == WL_MODE_FILE) || (user_options_extra->wordlist_mode == WL_MODE_MASK))
|
if ((user_options_extra->wordlist_mode == WL_MODE_FILE) || (user_options_extra->wordlist_mode == WL_MODE_MASK))
|
||||||
{
|
{
|
||||||
|
@ -146,6 +146,9 @@ static const char *const USAGE_BIG_PRE_HASHMODES[] =
|
|||||||
" --brain-session | Hex | Overrides automatically calculated brain session | --brain-session=0x2ae611db",
|
" --brain-session | Hex | Overrides automatically calculated brain session | --brain-session=0x2ae611db",
|
||||||
" --brain-session-whitelist | Hex | Allow given sessions only, separated with commas | --brain-session-whitelist=0x2ae611db",
|
" --brain-session-whitelist | Hex | Allow given sessions only, separated with commas | --brain-session-whitelist=0x2ae611db",
|
||||||
#endif
|
#endif
|
||||||
|
#if !defined(_WIN)
|
||||||
|
" --color | | Enables color output for cracked hashes |",
|
||||||
|
#endif
|
||||||
"",
|
"",
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
@ -154,6 +154,9 @@ static const struct option long_options[] =
|
|||||||
{"brain-session", required_argument, NULL, IDX_BRAIN_SESSION},
|
{"brain-session", required_argument, NULL, IDX_BRAIN_SESSION},
|
||||||
{"brain-session-whitelist", required_argument, NULL, IDX_BRAIN_SESSION_WHITELIST},
|
{"brain-session-whitelist", required_argument, NULL, IDX_BRAIN_SESSION_WHITELIST},
|
||||||
#endif
|
#endif
|
||||||
|
#if !defined(_WIN)
|
||||||
|
{"color", no_argument, NULL, IDX_COLOR},
|
||||||
|
#endif
|
||||||
{NULL, 0, NULL, 0 }
|
{NULL, 0, NULL, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -198,6 +201,9 @@ int user_options_init (hashcat_ctx_t *hashcat_ctx)
|
|||||||
user_options->brain_session = BRAIN_SESSION;
|
user_options->brain_session = BRAIN_SESSION;
|
||||||
user_options->brain_session_whitelist = NULL;
|
user_options->brain_session_whitelist = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
#if !defined(_WIN)
|
||||||
|
user_options->color = COLOR;
|
||||||
|
#endif
|
||||||
user_options->cpu_affinity = NULL;
|
user_options->cpu_affinity = NULL;
|
||||||
user_options->custom_charset_1 = NULL;
|
user_options->custom_charset_1 = NULL;
|
||||||
user_options->custom_charset_2 = NULL;
|
user_options->custom_charset_2 = NULL;
|
||||||
@ -548,6 +554,9 @@ int user_options_getopt (hashcat_ctx_t *hashcat_ctx, int argc, char **argv)
|
|||||||
case IDX_BRAIN_SESSION: user_options->brain_session = hc_strtoul (optarg, NULL, 16); break;
|
case IDX_BRAIN_SESSION: user_options->brain_session = hc_strtoul (optarg, NULL, 16); break;
|
||||||
case IDX_BRAIN_SESSION_WHITELIST: user_options->brain_session_whitelist = optarg; break;
|
case IDX_BRAIN_SESSION_WHITELIST: user_options->brain_session_whitelist = optarg; break;
|
||||||
#endif
|
#endif
|
||||||
|
#if !defined(_WIN)
|
||||||
|
case IDX_COLOR: user_options->color = true; break;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user