2016-10-02 23:27:55 +00:00
|
|
|
/**
|
|
|
|
* Author......: See docs/credits.txt
|
|
|
|
* License.....: MIT
|
|
|
|
*/
|
|
|
|
|
2016-10-31 10:28:06 +00:00
|
|
|
#include "common.h"
|
|
|
|
|
2016-10-02 23:27:55 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <getopt.h>
|
|
|
|
|
|
|
|
#include "types.h"
|
|
|
|
#include "user_options.h"
|
2016-10-07 19:47:11 +00:00
|
|
|
#include "usage.h"
|
|
|
|
#include "memory.h"
|
2016-10-13 15:27:09 +00:00
|
|
|
#include "hashcat.h"
|
2016-10-07 19:47:11 +00:00
|
|
|
#include "terminal.h"
|
|
|
|
#include "thread.h"
|
|
|
|
#include "status.h"
|
2017-07-06 08:35:25 +00:00
|
|
|
#include "shared.h"
|
2016-10-08 21:16:40 +00:00
|
|
|
#include "event.h"
|
2016-10-07 14:56:44 +00:00
|
|
|
|
2018-10-28 15:47:13 +00:00
|
|
|
#ifdef WITH_BRAIN
|
|
|
|
#include "brain.h"
|
|
|
|
#endif
|
|
|
|
|
2017-02-23 23:55:06 +00:00
|
|
|
#if defined (__MINGW64__) || defined (__MINGW32__)
|
2017-02-09 09:42:35 +00:00
|
|
|
int _dowildcard = -1;
|
|
|
|
#endif
|
|
|
|
|
2019-06-30 16:16:10 +00:00
|
|
|
static void main_log_clear_line (MAYBE_UNUSED const size_t prev_len, MAYBE_UNUSED FILE *fp)
|
2016-10-15 14:12:20 +00:00
|
|
|
{
|
2022-03-31 17:19:16 +00:00
|
|
|
if (!is_stdout_terminal ()) return;
|
2022-03-18 14:54:26 +00:00
|
|
|
|
2016-10-15 14:12:20 +00:00
|
|
|
#if defined (_WIN)
|
|
|
|
|
2019-06-30 16:16:10 +00:00
|
|
|
fputc ('\r', fp);
|
2016-10-15 14:12:20 +00:00
|
|
|
|
2019-06-30 16:16:10 +00:00
|
|
|
for (size_t i = 0; i < prev_len; i++) fputc (' ', fp);
|
2016-10-15 14:12:20 +00:00
|
|
|
|
2019-06-30 16:16:10 +00:00
|
|
|
fputc ('\r', fp);
|
2016-10-15 14:12:20 +00:00
|
|
|
|
|
|
|
#else
|
|
|
|
|
2019-06-30 16:16:10 +00:00
|
|
|
fputs ("\033[2K\r", fp);
|
2016-10-15 14:12:20 +00:00
|
|
|
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2019-06-30 16:16:10 +00:00
|
|
|
static void main_log (hashcat_ctx_t *hashcat_ctx, FILE *fp, const int loglevel)
|
2016-10-08 21:16:40 +00:00
|
|
|
{
|
2016-10-13 17:16:24 +00:00
|
|
|
event_ctx_t *event_ctx = hashcat_ctx->event_ctx;
|
|
|
|
|
2018-02-08 18:13:29 +00:00
|
|
|
const char *msg_buf = event_ctx->msg_buf;
|
|
|
|
const size_t msg_len = event_ctx->msg_len;
|
|
|
|
const bool msg_newline = event_ctx->msg_newline;
|
2016-10-08 21:16:40 +00:00
|
|
|
|
|
|
|
// handle last_len
|
|
|
|
|
2018-02-08 18:13:29 +00:00
|
|
|
const size_t prev_len = event_ctx->prev_len;
|
2016-10-08 21:16:40 +00:00
|
|
|
|
2019-06-30 16:16:10 +00:00
|
|
|
if (prev_len) main_log_clear_line (prev_len, fp);
|
2016-10-13 17:52:27 +00:00
|
|
|
|
2019-07-01 15:27:08 +00:00
|
|
|
if (msg_newline == true)
|
|
|
|
{
|
|
|
|
event_ctx->prev_len = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
event_ctx->prev_len = msg_len;
|
|
|
|
}
|
2016-10-13 17:52:27 +00:00
|
|
|
|
2016-10-15 14:12:20 +00:00
|
|
|
#if defined (_WIN)
|
2022-03-28 17:05:16 +00:00
|
|
|
HANDLE hConsole = GetStdHandle (STD_OUTPUT_HANDLE);
|
2016-10-13 17:52:27 +00:00
|
|
|
|
2022-03-28 17:05:16 +00:00
|
|
|
CONSOLE_SCREEN_BUFFER_INFO con_info;
|
2016-10-13 17:52:27 +00:00
|
|
|
|
2022-03-28 17:05:16 +00:00
|
|
|
GetConsoleScreenBufferInfo (hConsole, &con_info);
|
2016-10-13 17:52:27 +00:00
|
|
|
|
2022-03-28 17:05:16 +00:00
|
|
|
const int orig = con_info.wAttributes;
|
|
|
|
#endif
|
2016-10-08 21:16:40 +00:00
|
|
|
|
2022-03-28 17:05:16 +00:00
|
|
|
// color stuff pre
|
2022-03-31 17:19:16 +00:00
|
|
|
if (is_stdout_terminal ())
|
|
|
|
{
|
2022-03-28 17:05:16 +00:00
|
|
|
#if defined (_WIN)
|
2022-03-18 14:54:26 +00:00
|
|
|
switch (loglevel)
|
|
|
|
{
|
|
|
|
case LOGLEVEL_INFO:
|
|
|
|
break;
|
|
|
|
case LOGLEVEL_WARNING: SetConsoleTextAttribute (hConsole, 6);
|
|
|
|
break;
|
|
|
|
case LOGLEVEL_ERROR: SetConsoleTextAttribute (hConsole, FOREGROUND_RED | FOREGROUND_INTENSITY);
|
|
|
|
break;
|
|
|
|
case LOGLEVEL_ADVICE: SetConsoleTextAttribute (hConsole, 6);
|
|
|
|
break;
|
|
|
|
}
|
2016-10-15 14:12:20 +00:00
|
|
|
|
|
|
|
#else
|
2022-03-18 14:54:26 +00:00
|
|
|
switch (loglevel)
|
|
|
|
{
|
|
|
|
case LOGLEVEL_INFO: break;
|
|
|
|
case LOGLEVEL_WARNING: fwrite ("\033[33m", 5, 1, fp); break;
|
|
|
|
case LOGLEVEL_ERROR: fwrite ("\033[31m", 5, 1, fp); break;
|
|
|
|
case LOGLEVEL_ADVICE: fwrite ("\033[33m", 5, 1, fp); break;
|
|
|
|
}
|
2016-10-15 14:12:20 +00:00
|
|
|
#endif
|
2022-03-18 14:54:26 +00:00
|
|
|
}
|
2016-10-08 21:16:40 +00:00
|
|
|
|
|
|
|
// finally, print
|
|
|
|
|
2019-06-30 16:16:10 +00:00
|
|
|
fwrite (msg_buf, msg_len, 1, fp);
|
2016-10-13 17:16:24 +00:00
|
|
|
|
2016-10-15 14:12:20 +00:00
|
|
|
// color stuff post
|
2022-03-31 17:19:16 +00:00
|
|
|
if (is_stdout_terminal ())
|
|
|
|
{
|
2016-10-15 14:12:20 +00:00
|
|
|
#if defined (_WIN)
|
2022-03-18 14:54:26 +00:00
|
|
|
switch (loglevel)
|
|
|
|
{
|
|
|
|
case LOGLEVEL_INFO: break;
|
|
|
|
case LOGLEVEL_WARNING: SetConsoleTextAttribute (hConsole, orig); break;
|
|
|
|
case LOGLEVEL_ERROR: SetConsoleTextAttribute (hConsole, orig); break;
|
|
|
|
case LOGLEVEL_ADVICE: SetConsoleTextAttribute (hConsole, orig); break;
|
|
|
|
}
|
2016-10-15 14:12:20 +00:00
|
|
|
#else
|
2022-03-18 14:54:26 +00:00
|
|
|
switch (loglevel)
|
|
|
|
{
|
|
|
|
case LOGLEVEL_INFO: break;
|
|
|
|
case LOGLEVEL_WARNING: fwrite ("\033[0m", 4, 1, fp); break;
|
|
|
|
case LOGLEVEL_ERROR: fwrite ("\033[0m", 4, 1, fp); break;
|
|
|
|
case LOGLEVEL_ADVICE: fwrite ("\033[0m", 4, 1, fp); break;
|
|
|
|
}
|
2016-10-15 14:12:20 +00:00
|
|
|
#endif
|
2022-03-18 14:54:26 +00:00
|
|
|
}
|
2016-10-15 14:12:20 +00:00
|
|
|
|
|
|
|
// eventual newline
|
|
|
|
|
2016-10-13 17:16:24 +00:00
|
|
|
if (msg_newline == true)
|
|
|
|
{
|
2019-06-30 16:16:10 +00:00
|
|
|
fwrite (EOL, strlen (EOL), 1, fp);
|
2016-10-15 14:12:20 +00:00
|
|
|
|
|
|
|
// on error, add another newline
|
|
|
|
|
|
|
|
if (loglevel == LOGLEVEL_ERROR)
|
|
|
|
{
|
2019-06-30 16:16:10 +00:00
|
|
|
fwrite (EOL, strlen (EOL), 1, fp);
|
2016-10-15 14:12:20 +00:00
|
|
|
}
|
2016-10-13 17:16:24 +00:00
|
|
|
}
|
2016-10-08 21:16:40 +00:00
|
|
|
|
2019-06-30 16:16:10 +00:00
|
|
|
fflush (fp);
|
2016-10-08 21:16:40 +00:00
|
|
|
}
|
|
|
|
|
2017-03-25 19:50:37 +00:00
|
|
|
static void main_log_advice (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYBE_UNUSED const void *buf, MAYBE_UNUSED const size_t len)
|
|
|
|
{
|
|
|
|
const user_options_t *user_options = hashcat_ctx->user_options;
|
|
|
|
|
|
|
|
if (user_options->advice_disable == true) return;
|
|
|
|
|
2019-06-30 16:16:10 +00:00
|
|
|
main_log (hashcat_ctx, stdout, LOGLEVEL_ADVICE);
|
2017-03-25 19:50:37 +00:00
|
|
|
}
|
|
|
|
|
2016-10-12 09:27:10 +00:00
|
|
|
static void main_log_info (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYBE_UNUSED const void *buf, MAYBE_UNUSED const size_t len)
|
2016-10-08 21:16:40 +00:00
|
|
|
{
|
2019-06-30 16:16:10 +00:00
|
|
|
main_log (hashcat_ctx, stdout, LOGLEVEL_INFO);
|
2016-10-08 21:16:40 +00:00
|
|
|
}
|
|
|
|
|
2016-10-12 09:27:10 +00:00
|
|
|
static void main_log_warning (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYBE_UNUSED const void *buf, MAYBE_UNUSED const size_t len)
|
2016-10-08 21:16:40 +00:00
|
|
|
{
|
2019-06-30 16:16:10 +00:00
|
|
|
main_log (hashcat_ctx, stdout, LOGLEVEL_WARNING);
|
2016-10-08 21:16:40 +00:00
|
|
|
}
|
|
|
|
|
2016-10-12 09:27:10 +00:00
|
|
|
static void main_log_error (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYBE_UNUSED const void *buf, MAYBE_UNUSED const size_t len)
|
2016-10-08 21:16:40 +00:00
|
|
|
{
|
2019-06-30 16:16:10 +00:00
|
|
|
main_log (hashcat_ctx, stderr, LOGLEVEL_ERROR);
|
2016-10-08 21:16:40 +00:00
|
|
|
}
|
|
|
|
|
2016-10-14 17:25:13 +00:00
|
|
|
static void main_outerloop_starting (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYBE_UNUSED const void *buf, MAYBE_UNUSED const size_t len)
|
2016-10-07 14:56:44 +00:00
|
|
|
{
|
2016-10-07 19:47:11 +00:00
|
|
|
const user_options_t *user_options = hashcat_ctx->user_options;
|
|
|
|
const user_options_extra_t *user_options_extra = hashcat_ctx->user_options_extra;
|
|
|
|
|
|
|
|
hashcat_user_t *hashcat_user = hashcat_ctx->hashcat_user;
|
|
|
|
status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
|
2016-10-07 14:56:44 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* keypress thread
|
|
|
|
*/
|
|
|
|
|
|
|
|
hashcat_user->outer_threads_cnt = 0;
|
|
|
|
|
2016-11-20 21:54:52 +00:00
|
|
|
hashcat_user->outer_threads = (hc_thread_t *) hccalloc (2, sizeof (hc_thread_t)); if (hashcat_user->outer_threads == NULL) return;
|
2016-10-07 14:56:44 +00:00
|
|
|
|
|
|
|
status_ctx->shutdown_outer = false;
|
|
|
|
|
2022-02-13 11:33:11 +00:00
|
|
|
if (user_options->hash_info == true) return;
|
|
|
|
if (user_options->keyspace == true) return;
|
|
|
|
if (user_options->stdout_flag == true) return;
|
|
|
|
if (user_options->speed_only == true) return;
|
|
|
|
if (user_options->identify == true) return;
|
|
|
|
if (user_options->backend_info > 0) return;
|
2020-12-29 03:58:58 +00:00
|
|
|
|
|
|
|
if ((user_options_extra->wordlist_mode == WL_MODE_FILE) || (user_options_extra->wordlist_mode == WL_MODE_MASK))
|
2016-10-07 14:56:44 +00:00
|
|
|
{
|
2020-12-29 03:58:58 +00:00
|
|
|
// see thread_keypress() how to access status information
|
2016-10-07 14:56:44 +00:00
|
|
|
|
2020-12-29 03:58:58 +00:00
|
|
|
hc_thread_create (hashcat_user->outer_threads[hashcat_user->outer_threads_cnt], thread_keypress, hashcat_ctx);
|
2016-10-07 14:56:44 +00:00
|
|
|
|
2020-12-29 03:58:58 +00:00
|
|
|
hashcat_user->outer_threads_cnt++;
|
2016-10-07 14:56:44 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-10-14 17:25:13 +00:00
|
|
|
static void main_outerloop_finished (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYBE_UNUSED const void *buf, MAYBE_UNUSED const size_t len)
|
2016-10-07 14:56:44 +00:00
|
|
|
{
|
|
|
|
hashcat_user_t *hashcat_user = hashcat_ctx->hashcat_user;
|
|
|
|
status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
|
|
|
|
|
2018-10-16 13:59:20 +00:00
|
|
|
// we should never stop hashcat with STATUS_INIT:
|
|
|
|
// keypress thread blocks on STATUS_INIT forever!
|
|
|
|
|
|
|
|
if (status_ctx->devices_status == STATUS_INIT)
|
|
|
|
{
|
|
|
|
status_ctx->devices_status = STATUS_ERROR;
|
|
|
|
}
|
|
|
|
|
2016-10-07 14:56:44 +00:00
|
|
|
// wait for outer threads
|
|
|
|
|
|
|
|
status_ctx->shutdown_outer = true;
|
|
|
|
|
|
|
|
for (int thread_idx = 0; thread_idx < hashcat_user->outer_threads_cnt; thread_idx++)
|
|
|
|
{
|
|
|
|
hc_thread_wait (1, &hashcat_user->outer_threads[thread_idx]);
|
|
|
|
}
|
|
|
|
|
2016-10-10 09:03:11 +00:00
|
|
|
hcfree (hashcat_user->outer_threads);
|
2016-10-07 14:56:44 +00:00
|
|
|
|
|
|
|
hashcat_user->outer_threads_cnt = 0;
|
|
|
|
}
|
|
|
|
|
2016-10-12 09:27:10 +00:00
|
|
|
static void main_cracker_starting (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYBE_UNUSED const void *buf, MAYBE_UNUSED const size_t len)
|
2016-10-07 14:56:44 +00:00
|
|
|
{
|
2016-10-07 19:47:11 +00:00
|
|
|
const user_options_t *user_options = hashcat_ctx->user_options;
|
|
|
|
const user_options_extra_t *user_options_extra = hashcat_ctx->user_options_extra;
|
|
|
|
|
2016-10-12 09:27:10 +00:00
|
|
|
if (user_options->quiet == true) return;
|
2016-10-07 14:56:44 +00:00
|
|
|
|
|
|
|
// Tell the user we're about to start
|
|
|
|
|
|
|
|
if ((user_options_extra->wordlist_mode == WL_MODE_FILE) || (user_options_extra->wordlist_mode == WL_MODE_MASK))
|
|
|
|
{
|
2016-12-09 22:44:43 +00:00
|
|
|
if ((user_options->quiet == false) && (user_options->speed_only == false))
|
2016-10-07 14:56:44 +00:00
|
|
|
{
|
2017-02-10 18:46:52 +00:00
|
|
|
event_log_info_nn (hashcat_ctx, NULL);
|
2016-10-14 18:18:45 +00:00
|
|
|
|
2020-08-26 10:14:26 +00:00
|
|
|
clear_prompt (hashcat_ctx);
|
|
|
|
|
2017-11-26 09:50:22 +00:00
|
|
|
send_prompt (hashcat_ctx);
|
2016-10-07 14:56:44 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (user_options_extra->wordlist_mode == WL_MODE_STDIN)
|
|
|
|
{
|
2021-06-22 09:37:59 +00:00
|
|
|
event_log_info (hashcat_ctx, "Starting attack in stdin mode");
|
2017-02-10 18:46:52 +00:00
|
|
|
event_log_info (hashcat_ctx, NULL);
|
2016-10-07 14:56:44 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-10-12 09:27:10 +00:00
|
|
|
static void main_cracker_finished (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYBE_UNUSED const void *buf, MAYBE_UNUSED const size_t len)
|
2016-10-07 14:56:44 +00:00
|
|
|
{
|
2016-10-15 14:12:20 +00:00
|
|
|
const hashes_t *hashes = hashcat_ctx->hashes;
|
|
|
|
const user_options_t *user_options = hashcat_ctx->user_options;
|
|
|
|
const user_options_extra_t *user_options_extra = hashcat_ctx->user_options_extra;
|
|
|
|
|
2022-02-13 11:33:11 +00:00
|
|
|
if (user_options->hash_info == true) return;
|
|
|
|
if (user_options->keyspace == true) return;
|
|
|
|
if (user_options->stdout_flag == true) return;
|
|
|
|
if (user_options->backend_info > 0) return;
|
2016-10-15 16:27:58 +00:00
|
|
|
|
2016-10-15 14:12:20 +00:00
|
|
|
// if we had a prompt, clear it
|
|
|
|
|
|
|
|
if ((user_options_extra->wordlist_mode == WL_MODE_FILE) || (user_options_extra->wordlist_mode == WL_MODE_MASK))
|
|
|
|
{
|
2017-03-01 20:42:17 +00:00
|
|
|
if ((user_options->speed_only == false) && (user_options->quiet == false))
|
2016-10-15 14:12:20 +00:00
|
|
|
{
|
2017-11-26 09:50:22 +00:00
|
|
|
clear_prompt (hashcat_ctx);
|
2016-10-15 14:12:20 +00:00
|
|
|
}
|
|
|
|
}
|
2016-10-07 14:56:44 +00:00
|
|
|
|
|
|
|
// print final status
|
|
|
|
|
2016-12-09 22:44:43 +00:00
|
|
|
if (user_options->benchmark == true)
|
2016-10-07 14:56:44 +00:00
|
|
|
{
|
|
|
|
status_benchmark (hashcat_ctx);
|
|
|
|
|
|
|
|
if (user_options->machine_readable == false)
|
|
|
|
{
|
2017-02-10 18:46:52 +00:00
|
|
|
event_log_info (hashcat_ctx, NULL);
|
2016-10-07 14:56:44 +00:00
|
|
|
}
|
|
|
|
}
|
2016-12-09 22:44:43 +00:00
|
|
|
else if (user_options->progress_only == true)
|
|
|
|
{
|
|
|
|
status_progress (hashcat_ctx);
|
|
|
|
|
|
|
|
if (user_options->machine_readable == false)
|
|
|
|
{
|
2017-02-10 18:46:52 +00:00
|
|
|
event_log_info (hashcat_ctx, NULL);
|
2016-12-09 22:44:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (user_options->speed_only == true)
|
|
|
|
{
|
|
|
|
status_speed (hashcat_ctx);
|
|
|
|
|
|
|
|
if (user_options->machine_readable == false)
|
|
|
|
{
|
2017-02-10 18:46:52 +00:00
|
|
|
event_log_info (hashcat_ctx, NULL);
|
2016-12-09 22:44:43 +00:00
|
|
|
}
|
|
|
|
}
|
2017-01-12 08:01:21 +00:00
|
|
|
else if (user_options->machine_readable == true)
|
|
|
|
{
|
|
|
|
status_display (hashcat_ctx);
|
|
|
|
}
|
2018-10-21 09:50:44 +00:00
|
|
|
else if (user_options->status == true)
|
|
|
|
{
|
|
|
|
status_display (hashcat_ctx);
|
|
|
|
}
|
2022-03-26 23:02:02 +00:00
|
|
|
else if (user_options->status_json == true)
|
|
|
|
{
|
|
|
|
status_display (hashcat_ctx);
|
|
|
|
}
|
2016-10-07 14:56:44 +00:00
|
|
|
else
|
|
|
|
{
|
2016-10-20 08:21:25 +00:00
|
|
|
if (user_options->quiet == false)
|
|
|
|
{
|
2017-02-10 18:46:52 +00:00
|
|
|
if (hashes->digests_saved != hashes->digests_done) event_log_info (hashcat_ctx, NULL);
|
2016-10-07 14:56:44 +00:00
|
|
|
|
2016-10-20 08:21:25 +00:00
|
|
|
status_display (hashcat_ctx);
|
2016-10-07 14:56:44 +00:00
|
|
|
|
2017-02-10 18:46:52 +00:00
|
|
|
event_log_info (hashcat_ctx, NULL);
|
2016-10-20 08:21:25 +00:00
|
|
|
}
|
2016-10-07 14:56:44 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-10-12 09:27:10 +00:00
|
|
|
static void main_cracker_hash_cracked (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYBE_UNUSED const void *buf, MAYBE_UNUSED const size_t len)
|
2016-10-07 14:56:44 +00:00
|
|
|
{
|
2016-10-17 22:50:54 +00:00
|
|
|
outfile_ctx_t *outfile_ctx = hashcat_ctx->outfile_ctx;
|
|
|
|
status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
|
|
|
|
user_options_t *user_options = hashcat_ctx->user_options;
|
|
|
|
user_options_extra_t *user_options_extra = hashcat_ctx->user_options_extra;
|
2016-10-07 14:56:44 +00:00
|
|
|
|
2019-07-02 19:30:35 +00:00
|
|
|
if (outfile_ctx->fp.pfp != NULL) return; // cracked hash was not written to an outfile
|
2016-10-07 14:56:44 +00:00
|
|
|
|
2016-10-17 22:50:54 +00:00
|
|
|
if ((user_options_extra->wordlist_mode == WL_MODE_FILE) || (user_options_extra->wordlist_mode == WL_MODE_MASK))
|
|
|
|
{
|
2017-11-26 09:50:22 +00:00
|
|
|
if (outfile_ctx->filename == NULL) if (user_options->quiet == false) clear_prompt (hashcat_ctx);
|
2016-10-17 22:50:54 +00:00
|
|
|
}
|
|
|
|
|
2019-06-27 18:18:47 +00:00
|
|
|
fwrite (buf, len, 1, stdout);
|
|
|
|
fwrite (EOL, strlen (EOL), 1, stdout);
|
2016-10-17 22:50:54 +00:00
|
|
|
|
|
|
|
if ((user_options_extra->wordlist_mode == WL_MODE_FILE) || (user_options_extra->wordlist_mode == WL_MODE_MASK))
|
|
|
|
{
|
|
|
|
if (status_ctx->devices_status != STATUS_CRACKED)
|
|
|
|
{
|
2017-11-26 09:50:22 +00:00
|
|
|
if (outfile_ctx->filename == NULL) if (user_options->quiet == false) send_prompt (hashcat_ctx);
|
2016-10-17 22:50:54 +00:00
|
|
|
}
|
|
|
|
}
|
2016-10-07 14:56:44 +00:00
|
|
|
}
|
|
|
|
|
2016-10-12 09:27:10 +00:00
|
|
|
static void main_calculated_words_base (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYBE_UNUSED const void *buf, MAYBE_UNUSED const size_t len)
|
2016-10-07 19:47:11 +00:00
|
|
|
{
|
|
|
|
const status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
|
|
|
|
const user_options_t *user_options = hashcat_ctx->user_options;
|
|
|
|
|
2016-10-12 09:27:10 +00:00
|
|
|
if (user_options->keyspace == false) return;
|
2016-10-07 19:47:11 +00:00
|
|
|
|
2017-10-20 10:19:33 +00:00
|
|
|
event_log_info (hashcat_ctx, "%" PRIu64 "", status_ctx->words_base);
|
2016-10-07 19:47:11 +00:00
|
|
|
}
|
|
|
|
|
2016-10-12 09:27:10 +00:00
|
|
|
static void main_potfile_remove_parse_pre (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYBE_UNUSED const void *buf, MAYBE_UNUSED const size_t len)
|
2016-10-07 19:47:11 +00:00
|
|
|
{
|
|
|
|
const user_options_t *user_options = hashcat_ctx->user_options;
|
|
|
|
|
2016-10-12 09:27:10 +00:00
|
|
|
if (user_options->quiet == true) return;
|
2016-10-07 19:47:11 +00:00
|
|
|
|
2021-06-22 09:37:59 +00:00
|
|
|
event_log_info_nn (hashcat_ctx, "Comparing hashes with potfile entries. Please be patient...");
|
2016-10-07 19:47:11 +00:00
|
|
|
}
|
|
|
|
|
2016-10-12 09:27:10 +00:00
|
|
|
static void main_potfile_remove_parse_post (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYBE_UNUSED const void *buf, MAYBE_UNUSED const size_t len)
|
2016-10-10 09:10:04 +00:00
|
|
|
{
|
|
|
|
const user_options_t *user_options = hashcat_ctx->user_options;
|
|
|
|
|
2016-10-12 09:27:10 +00:00
|
|
|
if (user_options->quiet == true) return;
|
2016-10-10 09:10:04 +00:00
|
|
|
|
2021-06-22 09:37:59 +00:00
|
|
|
event_log_info_nn (hashcat_ctx, "Compared hashes with potfile entries");
|
2016-10-10 09:10:04 +00:00
|
|
|
}
|
|
|
|
|
2023-03-11 08:55:37 +00:00
|
|
|
static void main_rulesfiles_parse_pre (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYBE_UNUSED const void *buf, MAYBE_UNUSED const size_t len)
|
|
|
|
{
|
|
|
|
const user_options_t *user_options = hashcat_ctx->user_options;
|
|
|
|
|
|
|
|
if (user_options->quiet == true) return;
|
|
|
|
|
|
|
|
event_log_info_nn (hashcat_ctx, "Loading rules. Please be patient...");
|
|
|
|
}
|
|
|
|
|
|
|
|
static void main_rulesfiles_parse_post (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYBE_UNUSED const void *buf, MAYBE_UNUSED const size_t len)
|
|
|
|
{
|
|
|
|
const user_options_t *user_options = hashcat_ctx->user_options;
|
|
|
|
|
|
|
|
if (user_options->quiet == true) return;
|
|
|
|
|
|
|
|
event_log_info_nn (hashcat_ctx, "Loading rules finished");
|
|
|
|
}
|
|
|
|
|
2016-10-19 10:42:41 +00:00
|
|
|
static void main_potfile_hash_show (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYBE_UNUSED const void *buf, MAYBE_UNUSED const size_t len)
|
|
|
|
{
|
|
|
|
outfile_ctx_t *outfile_ctx = hashcat_ctx->outfile_ctx;
|
|
|
|
|
2019-07-02 19:30:35 +00:00
|
|
|
if (outfile_ctx->fp.pfp != NULL) return; // cracked hash was not written to an outfile
|
2016-10-19 10:42:41 +00:00
|
|
|
|
2019-06-27 18:18:47 +00:00
|
|
|
fwrite (buf, len, 1, stdout);
|
|
|
|
fwrite (EOL, strlen (EOL), 1, stdout);
|
2016-10-19 10:42:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void main_potfile_hash_left (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYBE_UNUSED const void *buf, MAYBE_UNUSED const size_t len)
|
2016-10-17 22:50:54 +00:00
|
|
|
{
|
|
|
|
outfile_ctx_t *outfile_ctx = hashcat_ctx->outfile_ctx;
|
|
|
|
|
2019-07-02 19:30:35 +00:00
|
|
|
if (outfile_ctx->fp.pfp != NULL) return; // cracked hash was not written to an outfile
|
2016-10-17 22:50:54 +00:00
|
|
|
|
2020-06-15 13:07:47 +00:00
|
|
|
fwrite (buf, len, 1, stdout);
|
2016-10-17 22:50:54 +00:00
|
|
|
}
|
|
|
|
|
2016-10-12 09:27:10 +00:00
|
|
|
static void main_potfile_num_cracked (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYBE_UNUSED const void *buf, MAYBE_UNUSED const size_t len)
|
2016-10-07 19:47:11 +00:00
|
|
|
{
|
|
|
|
const user_options_t *user_options = hashcat_ctx->user_options;
|
2022-08-19 10:02:21 +00:00
|
|
|
hashes_t *hashes = hashcat_ctx->hashes;
|
2016-10-07 19:47:11 +00:00
|
|
|
|
2016-10-12 09:27:10 +00:00
|
|
|
if (user_options->quiet == true) return;
|
2016-10-07 19:47:11 +00:00
|
|
|
|
2022-08-19 10:02:21 +00:00
|
|
|
if (hashes->digests_done_zero == 1)
|
|
|
|
{
|
|
|
|
event_log_info (hashcat_ctx, "INFO: Removed hash found as empty hash.");
|
|
|
|
event_log_info (hashcat_ctx, NULL);
|
|
|
|
}
|
|
|
|
else if (hashes->digests_done_zero > 1)
|
|
|
|
{
|
|
|
|
event_log_info (hashcat_ctx, "INFO: Removed %d hashes found as empty hashes.", hashes->digests_done_zero);
|
|
|
|
event_log_info (hashcat_ctx, NULL);
|
|
|
|
}
|
2016-10-07 19:47:11 +00:00
|
|
|
|
2022-08-19 10:02:21 +00:00
|
|
|
if (hashes->digests_done_pot == 1)
|
2016-10-07 19:47:11 +00:00
|
|
|
{
|
2022-08-19 10:02:21 +00:00
|
|
|
event_log_info (hashcat_ctx, "INFO: Removed hash found as potfile entry.");
|
|
|
|
event_log_info (hashcat_ctx, NULL);
|
|
|
|
}
|
|
|
|
else if (hashes->digests_done_pot > 1)
|
|
|
|
{
|
|
|
|
event_log_info (hashcat_ctx, "INFO: Removed %d hashes found as potfile entries.", hashes->digests_done_pot);
|
|
|
|
event_log_info (hashcat_ctx, NULL);
|
2016-10-07 19:47:11 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-10-12 09:27:10 +00:00
|
|
|
static void main_potfile_all_cracked (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYBE_UNUSED const void *buf, MAYBE_UNUSED const size_t len)
|
2016-10-07 19:47:11 +00:00
|
|
|
{
|
|
|
|
const user_options_t *user_options = hashcat_ctx->user_options;
|
|
|
|
|
2016-10-12 09:27:10 +00:00
|
|
|
if (user_options->quiet == true) return;
|
2016-10-07 19:47:11 +00:00
|
|
|
|
2022-08-19 10:02:21 +00:00
|
|
|
event_log_info (hashcat_ctx, "INFO: All hashes found as potfile and/or empty entries! Use --show to display them.");
|
2017-02-10 18:46:52 +00:00
|
|
|
event_log_info (hashcat_ctx, NULL);
|
2016-10-07 19:47:11 +00:00
|
|
|
}
|
|
|
|
|
2016-10-14 17:25:13 +00:00
|
|
|
static void main_outerloop_mainscreen (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYBE_UNUSED const void *buf, MAYBE_UNUSED const size_t len)
|
|
|
|
{
|
|
|
|
const bitmap_ctx_t *bitmap_ctx = hashcat_ctx->bitmap_ctx;
|
|
|
|
const hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
|
|
|
|
const hashes_t *hashes = hashcat_ctx->hashes;
|
|
|
|
const hwmon_ctx_t *hwmon_ctx = hashcat_ctx->hwmon_ctx;
|
|
|
|
const straight_ctx_t *straight_ctx = hashcat_ctx->straight_ctx;
|
|
|
|
const user_options_t *user_options = hashcat_ctx->user_options;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* In benchmark-mode, inform user which algorithm is checked
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (user_options->benchmark == true)
|
|
|
|
{
|
|
|
|
if (user_options->machine_readable == false)
|
|
|
|
{
|
2021-08-28 11:05:05 +00:00
|
|
|
char buf[HCBUFSIZ_TINY] = { 0 };
|
|
|
|
|
|
|
|
size_t len = 0;
|
|
|
|
|
2018-01-28 12:53:31 +00:00
|
|
|
if ((hashconfig->attack_exec == ATTACK_EXEC_OUTSIDE_KERNEL) && (hashconfig->is_salted == true))
|
|
|
|
{
|
2021-08-28 11:05:05 +00:00
|
|
|
len = snprintf (buf, sizeof (buf), "* Hash-Mode %d (%s) [Iterations: %d]", hashconfig->hash_mode, hashconfig->hash_name, hashes[0].salts_buf[0].salt_iter);
|
2018-01-28 12:53:31 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-08-28 11:05:05 +00:00
|
|
|
len = snprintf (buf, sizeof (buf), "* Hash-Mode %d (%s)", hashconfig->hash_mode, hashconfig->hash_name);
|
2018-01-28 12:53:31 +00:00
|
|
|
}
|
2021-08-28 11:05:05 +00:00
|
|
|
|
|
|
|
char line[HCBUFSIZ_TINY] = { 0 };
|
|
|
|
|
|
|
|
memset (line, '-', len);
|
|
|
|
|
|
|
|
line[len] = 0;
|
|
|
|
|
|
|
|
event_log_info (hashcat_ctx, "%s", line);
|
|
|
|
event_log_info (hashcat_ctx, "%s", buf);
|
|
|
|
event_log_info (hashcat_ctx, "%s", line);
|
|
|
|
event_log_info (hashcat_ctx, NULL);
|
2016-10-14 17:25:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (user_options->quiet == true) return;
|
|
|
|
|
|
|
|
event_log_info (hashcat_ctx, "Hashes: %u digests; %u unique digests, %u unique salts", hashes->hashes_cnt_orig, hashes->digests_cnt, hashes->salts_cnt);
|
|
|
|
event_log_info (hashcat_ctx, "Bitmaps: %u bits, %u entries, 0x%08x mask, %u bytes, %u/%u rotates", bitmap_ctx->bitmap_bits, bitmap_ctx->bitmap_nums, bitmap_ctx->bitmap_mask, bitmap_ctx->bitmap_size, bitmap_ctx->bitmap_shift1, bitmap_ctx->bitmap_shift2);
|
|
|
|
|
2020-09-29 13:56:32 +00:00
|
|
|
if ((user_options->attack_mode == ATTACK_MODE_STRAIGHT) || (user_options->attack_mode == ATTACK_MODE_ASSOCIATION))
|
2016-10-14 17:25:13 +00:00
|
|
|
{
|
|
|
|
event_log_info (hashcat_ctx, "Rules: %u", straight_ctx->kernel_rules_cnt);
|
|
|
|
}
|
|
|
|
|
2017-02-10 18:46:52 +00:00
|
|
|
if (user_options->quiet == false) event_log_info (hashcat_ctx, NULL);
|
2016-10-14 17:25:13 +00:00
|
|
|
|
|
|
|
if (hashconfig->opti_type)
|
|
|
|
{
|
2020-12-16 01:17:02 +00:00
|
|
|
event_log_info (hashcat_ctx, "Optimizers applied:");
|
2016-10-14 17:25:13 +00:00
|
|
|
|
|
|
|
for (u32 i = 0; i < 32; i++)
|
|
|
|
{
|
2019-08-04 01:19:46 +00:00
|
|
|
const u32 opti_bit = 1U << i;
|
2016-10-14 17:25:13 +00:00
|
|
|
|
|
|
|
if (hashconfig->opti_type & opti_bit) event_log_info (hashcat_ctx, "* %s", stroptitype (opti_bit));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-02-10 18:46:52 +00:00
|
|
|
event_log_info (hashcat_ctx, NULL);
|
2016-10-14 17:25:13 +00:00
|
|
|
|
2017-09-16 10:17:31 +00:00
|
|
|
if ((hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) == 0)
|
|
|
|
{
|
2017-09-16 20:33:04 +00:00
|
|
|
if (hashconfig->has_optimized_kernel == true)
|
|
|
|
{
|
2019-05-01 13:52:56 +00:00
|
|
|
event_log_advice (hashcat_ctx, "ATTENTION! Pure (unoptimized) backend kernels selected.");
|
2021-06-06 18:47:18 +00:00
|
|
|
event_log_advice (hashcat_ctx, "Pure kernels can crack longer passwords, but drastically reduce performance.");
|
|
|
|
event_log_advice (hashcat_ctx, "If you want to switch to optimized kernels, append -O to your commandline.");
|
2019-03-13 05:29:24 +00:00
|
|
|
event_log_advice (hashcat_ctx, "See the above message to find out about the exact limits.");
|
2017-09-16 20:33:04 +00:00
|
|
|
event_log_advice (hashcat_ctx, NULL);
|
|
|
|
}
|
2017-09-16 10:17:31 +00:00
|
|
|
}
|
2019-03-31 15:39:00 +00:00
|
|
|
|
2019-03-12 18:32:31 +00:00
|
|
|
if (user_options->keep_guessing == true)
|
|
|
|
{
|
2019-03-13 19:15:55 +00:00
|
|
|
event_log_advice (hashcat_ctx, "ATTENTION! --keep-guessing mode is enabled.");
|
|
|
|
event_log_advice (hashcat_ctx, "This tells hashcat to continue attacking all target hashes until exhaustion.");
|
|
|
|
event_log_advice (hashcat_ctx, "hashcat will NOT check for or remove targets present in the potfile, and");
|
|
|
|
event_log_advice (hashcat_ctx, "will add ALL plains/collisions found, even duplicates, to the potfile.");
|
2019-03-12 18:32:31 +00:00
|
|
|
event_log_advice (hashcat_ctx, NULL);
|
|
|
|
}
|
2022-02-27 09:18:54 +00:00
|
|
|
|
2022-09-07 20:50:20 +00:00
|
|
|
if (hashconfig->potfile_disable == true && user_options->attack_mode != ATTACK_MODE_ASSOCIATION)
|
2022-02-15 18:29:43 +00:00
|
|
|
{
|
|
|
|
event_log_advice (hashcat_ctx, "ATTENTION! Potfile storage is disabled for this hash mode.");
|
|
|
|
event_log_advice (hashcat_ctx, "Passwords cracked during this session will NOT be stored to the potfile.");
|
|
|
|
event_log_advice (hashcat_ctx, "Consider using -o to save cracked passwords.");
|
|
|
|
event_log_advice (hashcat_ctx, NULL);
|
|
|
|
}
|
2022-09-07 20:50:20 +00:00
|
|
|
|
|
|
|
if (user_options->attack_mode == ATTACK_MODE_ASSOCIATION)
|
|
|
|
{
|
|
|
|
event_log_advice (hashcat_ctx, "ATTENTION! Potfile read/write is disabled for this attack mode.");
|
|
|
|
event_log_advice (hashcat_ctx, "Passwords cracked during this session will NOT be stored to the potfile.");
|
|
|
|
event_log_advice (hashcat_ctx, "Consider using -o to save cracked passwords.");
|
|
|
|
event_log_advice (hashcat_ctx, NULL);
|
|
|
|
}
|
2016-10-14 17:25:13 +00:00
|
|
|
/**
|
|
|
|
* Watchdog and Temperature balance
|
|
|
|
*/
|
|
|
|
|
2018-08-28 20:28:44 +00:00
|
|
|
if (hwmon_ctx->enabled == false)
|
2016-10-14 17:25:13 +00:00
|
|
|
{
|
2017-04-02 08:18:59 +00:00
|
|
|
event_log_info (hashcat_ctx, "Watchdog: Hardware monitoring interface not found on your system.");
|
2016-10-14 17:25:13 +00:00
|
|
|
}
|
|
|
|
|
2018-11-09 11:48:27 +00:00
|
|
|
if (hwmon_ctx->enabled == true && user_options->hwmon_temp_abort > 0)
|
2016-10-14 17:25:13 +00:00
|
|
|
{
|
2018-11-09 11:48:27 +00:00
|
|
|
event_log_info (hashcat_ctx, "Watchdog: Temperature abort trigger set to %uc", user_options->hwmon_temp_abort);
|
2016-10-14 17:25:13 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2017-04-02 07:50:06 +00:00
|
|
|
event_log_info (hashcat_ctx, "Watchdog: Temperature abort trigger disabled.");
|
2016-10-14 17:25:13 +00:00
|
|
|
}
|
|
|
|
|
2017-02-10 18:46:52 +00:00
|
|
|
event_log_info (hashcat_ctx, NULL);
|
2016-10-14 17:25:13 +00:00
|
|
|
}
|
|
|
|
|
2019-04-25 12:45:17 +00:00
|
|
|
static void main_backend_session_pre (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYBE_UNUSED const void *buf, MAYBE_UNUSED const size_t len)
|
2016-10-07 19:47:11 +00:00
|
|
|
{
|
|
|
|
const user_options_t *user_options = hashcat_ctx->user_options;
|
|
|
|
|
2016-10-12 09:27:10 +00:00
|
|
|
if (user_options->quiet == true) return;
|
2016-10-07 19:47:11 +00:00
|
|
|
|
2021-06-22 09:37:59 +00:00
|
|
|
event_log_info_nn (hashcat_ctx, "Initializing device kernels and memory. Please be patient...");
|
2016-10-07 19:47:11 +00:00
|
|
|
}
|
|
|
|
|
2019-04-25 12:45:17 +00:00
|
|
|
static void main_backend_session_post (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYBE_UNUSED const void *buf, MAYBE_UNUSED const size_t len)
|
2016-10-07 19:47:11 +00:00
|
|
|
{
|
|
|
|
const user_options_t *user_options = hashcat_ctx->user_options;
|
|
|
|
|
2016-10-12 09:27:10 +00:00
|
|
|
if (user_options->quiet == true) return;
|
2016-10-07 19:47:11 +00:00
|
|
|
|
2021-06-22 09:37:59 +00:00
|
|
|
event_log_info_nn (hashcat_ctx, "Initialized device kernels and memory");
|
2016-10-07 19:47:11 +00:00
|
|
|
}
|
|
|
|
|
2019-05-10 14:37:49 +00:00
|
|
|
static void main_backend_session_hostmem (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYBE_UNUSED const void *buf, MAYBE_UNUSED const size_t len)
|
|
|
|
{
|
|
|
|
const user_options_t *user_options = hashcat_ctx->user_options;
|
|
|
|
|
|
|
|
if (user_options->quiet == true) return;
|
|
|
|
|
|
|
|
const u64 *hostmem = (const u64 *) buf;
|
|
|
|
|
|
|
|
event_log_info (hashcat_ctx, "Host memory required for this attack: %" PRIu64 " MB", *hostmem / (1024 * 1024));
|
|
|
|
event_log_info (hashcat_ctx, NULL);
|
|
|
|
}
|
|
|
|
|
2019-05-01 13:52:56 +00:00
|
|
|
static void main_backend_device_init_pre (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYBE_UNUSED const void *buf, MAYBE_UNUSED const size_t len)
|
2018-11-12 19:45:05 +00:00
|
|
|
{
|
|
|
|
const user_options_t *user_options = hashcat_ctx->user_options;
|
|
|
|
|
|
|
|
if (user_options->quiet == true) return;
|
|
|
|
|
|
|
|
const u32 *device_id = (const u32 *) buf;
|
|
|
|
|
2021-06-22 09:37:59 +00:00
|
|
|
event_log_info_nn (hashcat_ctx, "Initializing backend runtime for device #%u. Please be patient...", *device_id + 1);
|
2018-11-12 19:45:05 +00:00
|
|
|
}
|
|
|
|
|
2019-05-01 13:52:56 +00:00
|
|
|
static void main_backend_device_init_post (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYBE_UNUSED const void *buf, MAYBE_UNUSED const size_t len)
|
2018-11-12 19:45:05 +00:00
|
|
|
{
|
|
|
|
const user_options_t *user_options = hashcat_ctx->user_options;
|
|
|
|
|
|
|
|
if (user_options->quiet == true) return;
|
|
|
|
|
|
|
|
const u32 *device_id = (const u32 *) buf;
|
|
|
|
|
2021-06-22 09:37:59 +00:00
|
|
|
event_log_info_nn (hashcat_ctx, "Initialized backend runtime for device #%u", *device_id + 1);
|
2018-11-12 19:45:05 +00:00
|
|
|
}
|
|
|
|
|
2016-10-12 09:27:10 +00:00
|
|
|
static void main_bitmap_init_pre (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYBE_UNUSED const void *buf, MAYBE_UNUSED const size_t len)
|
2016-10-07 20:16:03 +00:00
|
|
|
{
|
|
|
|
const user_options_t *user_options = hashcat_ctx->user_options;
|
|
|
|
|
2016-10-12 09:27:10 +00:00
|
|
|
if (user_options->quiet == true) return;
|
2016-10-07 20:16:03 +00:00
|
|
|
|
2016-10-12 12:36:47 +00:00
|
|
|
event_log_info_nn (hashcat_ctx, "Generating bitmap tables...");
|
2016-10-07 20:16:03 +00:00
|
|
|
}
|
|
|
|
|
2016-10-12 09:27:10 +00:00
|
|
|
static void main_bitmap_init_post (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYBE_UNUSED const void *buf, MAYBE_UNUSED const size_t len)
|
2016-10-07 20:16:03 +00:00
|
|
|
{
|
|
|
|
const user_options_t *user_options = hashcat_ctx->user_options;
|
|
|
|
|
2016-10-12 09:27:10 +00:00
|
|
|
if (user_options->quiet == true) return;
|
2016-10-07 20:16:03 +00:00
|
|
|
|
2021-06-22 09:37:59 +00:00
|
|
|
event_log_info_nn (hashcat_ctx, "Generated bitmap tables");
|
2016-10-07 20:16:03 +00:00
|
|
|
}
|
|
|
|
|
2018-11-04 09:07:45 +00:00
|
|
|
static void main_bitmap_final_overflow (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYBE_UNUSED const void *buf, MAYBE_UNUSED const size_t len)
|
|
|
|
{
|
|
|
|
const user_options_t *user_options = hashcat_ctx->user_options;
|
|
|
|
|
|
|
|
if (user_options->quiet == true) return;
|
|
|
|
|
|
|
|
event_log_advice (hashcat_ctx, "Bitmap table overflowed at %d bits.", user_options->bitmap_max);
|
|
|
|
event_log_advice (hashcat_ctx, "This typically happens with too many hashes and reduces your performance.");
|
|
|
|
event_log_advice (hashcat_ctx, "You can increase the bitmap table size with --bitmap-max, but");
|
|
|
|
event_log_advice (hashcat_ctx, "this creates a trade-off between L2-cache and bitmap efficiency.");
|
|
|
|
event_log_advice (hashcat_ctx, "It is therefore not guaranteed to restore full performance.");
|
|
|
|
event_log_advice (hashcat_ctx, NULL);
|
|
|
|
}
|
|
|
|
|
2016-10-12 09:27:10 +00:00
|
|
|
static void main_set_kernel_power_final (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYBE_UNUSED const void *buf, MAYBE_UNUSED const size_t len)
|
2016-10-07 20:25:52 +00:00
|
|
|
{
|
|
|
|
const user_options_t *user_options = hashcat_ctx->user_options;
|
|
|
|
|
2016-10-12 09:27:10 +00:00
|
|
|
if (user_options->quiet == true) return;
|
2016-10-07 20:25:52 +00:00
|
|
|
|
2017-11-26 09:50:22 +00:00
|
|
|
clear_prompt (hashcat_ctx);
|
2016-10-07 20:25:52 +00:00
|
|
|
|
2017-04-02 07:50:06 +00:00
|
|
|
event_log_advice (hashcat_ctx, "Approaching final keyspace - workload adjusted.");
|
2017-03-25 19:50:37 +00:00
|
|
|
event_log_advice (hashcat_ctx, NULL);
|
2016-10-07 20:25:52 +00:00
|
|
|
|
2017-11-26 09:50:22 +00:00
|
|
|
send_prompt (hashcat_ctx);
|
2016-10-07 20:25:52 +00:00
|
|
|
}
|
2016-10-07 20:16:03 +00:00
|
|
|
|
2016-10-17 23:24:03 +00:00
|
|
|
static void main_monitor_throttle1 (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYBE_UNUSED const void *buf, MAYBE_UNUSED const size_t len)
|
|
|
|
{
|
|
|
|
const user_options_t *user_options = hashcat_ctx->user_options;
|
|
|
|
const user_options_extra_t *user_options_extra = hashcat_ctx->user_options_extra;
|
|
|
|
|
|
|
|
if (user_options->quiet == true) return;
|
|
|
|
|
|
|
|
if ((user_options_extra->wordlist_mode == WL_MODE_FILE) || (user_options_extra->wordlist_mode == WL_MODE_MASK))
|
|
|
|
{
|
2017-11-26 09:50:22 +00:00
|
|
|
clear_prompt (hashcat_ctx);
|
2016-10-17 23:24:03 +00:00
|
|
|
}
|
|
|
|
|
2017-11-14 04:46:26 +00:00
|
|
|
const u32 *device_id = (const u32 *) buf;
|
2016-10-17 23:24:03 +00:00
|
|
|
|
2017-04-02 07:50:06 +00:00
|
|
|
event_log_warning (hashcat_ctx, "Driver temperature threshold met on GPU #%u. Expect reduced performance.", *device_id + 1);
|
2016-10-17 23:24:03 +00:00
|
|
|
|
|
|
|
if ((user_options_extra->wordlist_mode == WL_MODE_FILE) || (user_options_extra->wordlist_mode == WL_MODE_MASK))
|
|
|
|
{
|
2017-11-26 09:50:22 +00:00
|
|
|
send_prompt (hashcat_ctx);
|
2016-10-17 23:24:03 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void main_monitor_throttle2 (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYBE_UNUSED const void *buf, MAYBE_UNUSED const size_t len)
|
|
|
|
{
|
|
|
|
const user_options_t *user_options = hashcat_ctx->user_options;
|
|
|
|
const user_options_extra_t *user_options_extra = hashcat_ctx->user_options_extra;
|
|
|
|
|
|
|
|
if (user_options->quiet == true) return;
|
|
|
|
|
|
|
|
if ((user_options_extra->wordlist_mode == WL_MODE_FILE) || (user_options_extra->wordlist_mode == WL_MODE_MASK))
|
|
|
|
{
|
2017-11-26 09:50:22 +00:00
|
|
|
clear_prompt (hashcat_ctx);
|
2016-10-17 23:24:03 +00:00
|
|
|
}
|
|
|
|
|
2017-11-14 04:46:26 +00:00
|
|
|
const u32 *device_id = (const u32 *) buf;
|
2016-10-17 23:24:03 +00:00
|
|
|
|
2017-04-02 07:50:06 +00:00
|
|
|
event_log_warning (hashcat_ctx, "Driver temperature threshold met on GPU #%u. Expect reduced performance.", *device_id + 1);
|
2016-10-17 23:24:03 +00:00
|
|
|
|
|
|
|
if ((user_options_extra->wordlist_mode == WL_MODE_FILE) || (user_options_extra->wordlist_mode == WL_MODE_MASK))
|
|
|
|
{
|
2017-11-26 09:50:22 +00:00
|
|
|
send_prompt (hashcat_ctx);
|
2016-10-17 23:24:03 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void main_monitor_throttle3 (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYBE_UNUSED const void *buf, MAYBE_UNUSED const size_t len)
|
|
|
|
{
|
|
|
|
const user_options_t *user_options = hashcat_ctx->user_options;
|
|
|
|
const user_options_extra_t *user_options_extra = hashcat_ctx->user_options_extra;
|
|
|
|
|
|
|
|
if (user_options->quiet == true) return;
|
|
|
|
|
|
|
|
if ((user_options_extra->wordlist_mode == WL_MODE_FILE) || (user_options_extra->wordlist_mode == WL_MODE_MASK))
|
|
|
|
{
|
2017-11-26 09:50:22 +00:00
|
|
|
clear_prompt (hashcat_ctx);
|
2016-10-17 23:24:03 +00:00
|
|
|
}
|
|
|
|
|
2017-11-14 04:46:26 +00:00
|
|
|
const u32 *device_id = (const u32 *) buf;
|
2016-10-17 23:24:03 +00:00
|
|
|
|
2017-04-02 07:50:06 +00:00
|
|
|
event_log_warning (hashcat_ctx, "Driver temperature threshold met on GPU #%u. Expect reduced performance.", *device_id + 1);
|
2017-02-10 18:46:52 +00:00
|
|
|
event_log_warning (hashcat_ctx, NULL);
|
2016-10-17 23:24:03 +00:00
|
|
|
|
|
|
|
if ((user_options_extra->wordlist_mode == WL_MODE_FILE) || (user_options_extra->wordlist_mode == WL_MODE_MASK))
|
|
|
|
{
|
2017-11-26 09:50:22 +00:00
|
|
|
send_prompt (hashcat_ctx);
|
2016-10-17 23:24:03 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-11-21 17:30:36 +00:00
|
|
|
static void main_monitor_performance_hint (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYBE_UNUSED const void *buf, MAYBE_UNUSED const size_t len)
|
|
|
|
{
|
2017-09-16 10:17:31 +00:00
|
|
|
const hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
|
2016-11-21 17:30:36 +00:00
|
|
|
const user_options_t *user_options = hashcat_ctx->user_options;
|
|
|
|
const user_options_extra_t *user_options_extra = hashcat_ctx->user_options_extra;
|
|
|
|
|
|
|
|
if (user_options->quiet == true) return;
|
|
|
|
|
|
|
|
if ((user_options_extra->wordlist_mode == WL_MODE_FILE) || (user_options_extra->wordlist_mode == WL_MODE_MASK))
|
|
|
|
{
|
2017-11-26 09:50:22 +00:00
|
|
|
clear_prompt (hashcat_ctx);
|
2016-11-21 17:30:36 +00:00
|
|
|
}
|
|
|
|
|
2017-09-16 10:17:31 +00:00
|
|
|
event_log_advice (hashcat_ctx, "Cracking performance lower than expected?");
|
|
|
|
event_log_advice (hashcat_ctx, NULL);
|
|
|
|
|
2021-05-19 06:31:51 +00:00
|
|
|
if (user_options->optimized_kernel_enable == false)
|
2016-11-21 17:30:36 +00:00
|
|
|
{
|
2021-05-19 06:31:51 +00:00
|
|
|
if ((hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) == 0)
|
2017-09-16 20:33:04 +00:00
|
|
|
{
|
2021-05-19 06:31:51 +00:00
|
|
|
if (hashconfig->has_optimized_kernel == true)
|
|
|
|
{
|
|
|
|
event_log_advice (hashcat_ctx, "* Append -O to the commandline.");
|
2021-06-06 18:47:18 +00:00
|
|
|
event_log_advice (hashcat_ctx, " This lowers the maximum supported password/salt length (usually down to 32).");
|
2021-05-19 06:31:51 +00:00
|
|
|
event_log_advice (hashcat_ctx, NULL);
|
|
|
|
}
|
2017-09-16 20:33:04 +00:00
|
|
|
}
|
2016-11-21 17:30:36 +00:00
|
|
|
}
|
2017-09-16 10:17:31 +00:00
|
|
|
|
|
|
|
if (user_options->workload_profile < 3)
|
2016-11-21 17:30:36 +00:00
|
|
|
{
|
2017-09-16 10:17:31 +00:00
|
|
|
event_log_advice (hashcat_ctx, "* Append -w 3 to the commandline.");
|
|
|
|
event_log_advice (hashcat_ctx, " This can cause your screen to lag.");
|
2017-03-25 19:50:37 +00:00
|
|
|
event_log_advice (hashcat_ctx, NULL);
|
2016-11-21 17:30:36 +00:00
|
|
|
}
|
|
|
|
|
2021-05-19 06:31:51 +00:00
|
|
|
if (user_options->slow_candidates == false)
|
|
|
|
{
|
2022-02-14 18:43:20 +00:00
|
|
|
if ((user_options_extra->wordlist_mode == WL_MODE_FILE) || (user_options_extra->wordlist_mode == WL_MODE_MASK))
|
|
|
|
{
|
2022-02-14 18:57:51 +00:00
|
|
|
if ((user_options->attack_mode != ATTACK_MODE_HYBRID1) && (user_options->attack_mode != ATTACK_MODE_HYBRID2) && (user_options->attack_mode != ATTACK_MODE_ASSOCIATION))
|
2022-02-14 18:51:33 +00:00
|
|
|
{
|
|
|
|
event_log_advice (hashcat_ctx, "* Append -S to the commandline.");
|
|
|
|
event_log_advice (hashcat_ctx, " This has a drastic speed impact but can be better for specific attacks.");
|
|
|
|
event_log_advice (hashcat_ctx, " Typical scenarios are a small wordlist but a large ruleset.");
|
|
|
|
event_log_advice (hashcat_ctx, NULL);
|
|
|
|
}
|
2022-02-14 18:43:20 +00:00
|
|
|
}
|
2021-05-19 06:31:51 +00:00
|
|
|
}
|
2022-02-27 09:18:54 +00:00
|
|
|
|
2019-05-01 13:52:56 +00:00
|
|
|
event_log_advice (hashcat_ctx, "* Update your backend API runtime / driver the right way:");
|
2017-09-16 10:17:31 +00:00
|
|
|
event_log_advice (hashcat_ctx, " https://hashcat.net/faq/wrongdriver");
|
|
|
|
event_log_advice (hashcat_ctx, NULL);
|
|
|
|
event_log_advice (hashcat_ctx, "* Create more work items to make use of your parallelization power:");
|
|
|
|
event_log_advice (hashcat_ctx, " https://hashcat.net/faq/morework");
|
|
|
|
event_log_advice (hashcat_ctx, NULL);
|
|
|
|
|
|
|
|
|
2016-11-21 17:30:36 +00:00
|
|
|
if ((user_options_extra->wordlist_mode == WL_MODE_FILE) || (user_options_extra->wordlist_mode == WL_MODE_MASK))
|
|
|
|
{
|
2017-11-26 09:50:22 +00:00
|
|
|
send_prompt (hashcat_ctx);
|
2016-11-21 17:30:36 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-10-17 08:55:47 +00:00
|
|
|
static void main_monitor_noinput_hint (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYBE_UNUSED const void *buf, MAYBE_UNUSED const size_t len)
|
|
|
|
{
|
|
|
|
const user_options_t *user_options = hashcat_ctx->user_options;
|
|
|
|
|
|
|
|
if (user_options->quiet == true) return;
|
|
|
|
|
2021-06-06 18:47:18 +00:00
|
|
|
event_log_advice (hashcat_ctx, "ATTENTION! Read timeout in stdin mode. Password candidates input is too slow:");
|
|
|
|
event_log_advice (hashcat_ctx, "* Are you sure you are using the correct attack mode (--attack-mode or -a)?");
|
|
|
|
event_log_advice (hashcat_ctx, "* Are you sure you want to use input from standard input (stdin)?");
|
|
|
|
event_log_advice (hashcat_ctx, "* If using stdin, are you sure it is working correctly, and is fast enough?");
|
2018-10-17 08:55:47 +00:00
|
|
|
event_log_advice (hashcat_ctx, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void main_monitor_noinput_abort (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYBE_UNUSED const void *buf, MAYBE_UNUSED const size_t len)
|
|
|
|
{
|
2021-06-22 09:37:59 +00:00
|
|
|
event_log_error (hashcat_ctx, "No password candidates received in stdin mode, aborting");
|
2018-10-17 08:55:47 +00:00
|
|
|
}
|
|
|
|
|
2016-10-17 23:24:03 +00:00
|
|
|
static void main_monitor_temp_abort (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYBE_UNUSED const void *buf, MAYBE_UNUSED const size_t len)
|
|
|
|
{
|
|
|
|
const user_options_t *user_options = hashcat_ctx->user_options;
|
|
|
|
const user_options_extra_t *user_options_extra = hashcat_ctx->user_options_extra;
|
|
|
|
|
|
|
|
|
2023-01-20 14:09:10 +00:00
|
|
|
if (((user_options_extra->wordlist_mode == WL_MODE_FILE) || (user_options_extra->wordlist_mode == WL_MODE_MASK)) && user_options->quiet == false)
|
2016-10-17 23:24:03 +00:00
|
|
|
{
|
2017-11-26 09:50:22 +00:00
|
|
|
clear_prompt (hashcat_ctx);
|
2016-10-17 23:24:03 +00:00
|
|
|
}
|
|
|
|
|
2017-11-14 04:46:26 +00:00
|
|
|
const u32 *device_id = (const u32 *) buf;
|
2016-10-17 23:24:03 +00:00
|
|
|
|
2021-06-22 09:37:59 +00:00
|
|
|
event_log_error (hashcat_ctx, "Temperature limit on GPU #%u reached, aborting", *device_id + 1);
|
2016-10-17 23:24:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void main_monitor_runtime_limit (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYBE_UNUSED const void *buf, MAYBE_UNUSED const size_t len)
|
|
|
|
{
|
|
|
|
const user_options_t *user_options = hashcat_ctx->user_options;
|
|
|
|
const user_options_extra_t *user_options_extra = hashcat_ctx->user_options_extra;
|
|
|
|
|
|
|
|
if (user_options->quiet == true) return;
|
|
|
|
|
|
|
|
if ((user_options_extra->wordlist_mode == WL_MODE_FILE) || (user_options_extra->wordlist_mode == WL_MODE_MASK))
|
|
|
|
{
|
2017-11-26 09:50:22 +00:00
|
|
|
clear_prompt (hashcat_ctx);
|
2016-10-17 23:24:03 +00:00
|
|
|
}
|
|
|
|
|
2021-06-22 09:37:59 +00:00
|
|
|
event_log_warning (hashcat_ctx, "Runtime limit reached, aborting");
|
2016-10-17 23:24:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void main_monitor_status_refresh (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYBE_UNUSED const void *buf, MAYBE_UNUSED const size_t len)
|
|
|
|
{
|
|
|
|
const user_options_t *user_options = hashcat_ctx->user_options;
|
|
|
|
const user_options_extra_t *user_options_extra = hashcat_ctx->user_options_extra;
|
2017-05-18 14:36:14 +00:00
|
|
|
const status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
|
|
|
|
|
|
|
|
if (status_ctx->accessible == false) return;
|
2016-10-17 23:24:03 +00:00
|
|
|
|
|
|
|
if ((user_options_extra->wordlist_mode == WL_MODE_FILE) || (user_options_extra->wordlist_mode == WL_MODE_MASK))
|
|
|
|
{
|
|
|
|
if (user_options->quiet == false)
|
|
|
|
{
|
2017-11-26 09:50:22 +00:00
|
|
|
//clear_prompt (hashcat_ctx);
|
2016-10-17 23:24:03 +00:00
|
|
|
|
2017-02-10 18:46:52 +00:00
|
|
|
event_log_info (hashcat_ctx, NULL);
|
|
|
|
event_log_info (hashcat_ctx, NULL);
|
2016-10-17 23:24:03 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
status_display (hashcat_ctx);
|
|
|
|
|
|
|
|
if ((user_options_extra->wordlist_mode == WL_MODE_FILE) || (user_options_extra->wordlist_mode == WL_MODE_MASK))
|
|
|
|
{
|
|
|
|
if (user_options->quiet == false)
|
|
|
|
{
|
2017-02-10 18:46:52 +00:00
|
|
|
event_log_info (hashcat_ctx, NULL);
|
2016-10-17 23:24:03 +00:00
|
|
|
|
2017-11-26 09:50:22 +00:00
|
|
|
send_prompt (hashcat_ctx);
|
2016-10-17 23:24:03 +00:00
|
|
|
}
|
|
|
|
}
|
2016-12-29 12:05:29 +00:00
|
|
|
|
|
|
|
if (user_options_extra->wordlist_mode == WL_MODE_STDIN)
|
|
|
|
{
|
|
|
|
if (user_options->quiet == false)
|
|
|
|
{
|
2017-02-10 18:46:52 +00:00
|
|
|
event_log_info (hashcat_ctx, NULL);
|
2016-12-29 12:05:29 +00:00
|
|
|
}
|
|
|
|
}
|
2016-10-17 23:24:03 +00:00
|
|
|
}
|
|
|
|
|
2016-10-23 12:06:52 +00:00
|
|
|
static void main_wordlist_cache_hit (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYBE_UNUSED const void *buf, MAYBE_UNUSED const size_t len)
|
|
|
|
{
|
|
|
|
const user_options_t *user_options = hashcat_ctx->user_options;
|
|
|
|
|
|
|
|
if (user_options->quiet == true) return;
|
|
|
|
|
2017-11-14 04:46:26 +00:00
|
|
|
const cache_hit_t *cache_hit = (const cache_hit_t *) buf;
|
2016-10-23 12:06:52 +00:00
|
|
|
|
2017-03-25 15:11:01 +00:00
|
|
|
event_log_info (hashcat_ctx, "Dictionary cache hit:");
|
|
|
|
event_log_info (hashcat_ctx, "* Filename..: %s", cache_hit->dictfile);
|
2017-10-20 10:19:33 +00:00
|
|
|
event_log_info (hashcat_ctx, "* Passwords.: %" PRIu64, cache_hit->cached_cnt);
|
|
|
|
event_log_info (hashcat_ctx, "* Bytes.....: %" PRId64, cache_hit->stat.st_size);
|
|
|
|
event_log_info (hashcat_ctx, "* Keyspace..: %" PRIu64, cache_hit->keyspace);
|
2017-02-10 18:46:52 +00:00
|
|
|
event_log_info (hashcat_ctx, NULL);
|
2016-10-23 12:06:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void main_wordlist_cache_generate (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYBE_UNUSED const void *buf, MAYBE_UNUSED const size_t len)
|
|
|
|
{
|
|
|
|
const user_options_t *user_options = hashcat_ctx->user_options;
|
|
|
|
|
|
|
|
if (user_options->quiet == true) return;
|
|
|
|
|
2017-11-14 04:46:26 +00:00
|
|
|
const cache_generate_t *cache_generate = (const cache_generate_t *) buf;
|
2016-10-23 12:06:52 +00:00
|
|
|
|
|
|
|
if (cache_generate->percent < 100)
|
|
|
|
{
|
2017-10-20 10:19:33 +00:00
|
|
|
event_log_info_nn (hashcat_ctx, "Dictionary cache building %s: %" PRIu64 " bytes (%.2f%%)", cache_generate->dictfile, cache_generate->comp, cache_generate->percent);
|
2016-10-23 12:06:52 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-01-31 15:40:01 +00:00
|
|
|
char *runtime = (char *) hcmalloc (HCBUFSIZ_TINY);
|
2017-05-23 08:07:04 +00:00
|
|
|
|
2017-12-10 00:40:45 +00:00
|
|
|
const time_t runtime_sec = cache_generate->runtime;
|
2017-05-30 13:03:43 +00:00
|
|
|
|
2017-05-23 08:07:04 +00:00
|
|
|
struct tm *tmp;
|
2017-08-16 17:43:41 +00:00
|
|
|
struct tm tm;
|
2017-05-23 08:07:04 +00:00
|
|
|
|
2017-12-10 00:40:45 +00:00
|
|
|
tmp = gmtime_r (&runtime_sec, &tm);
|
2017-05-23 08:07:04 +00:00
|
|
|
|
|
|
|
format_timer_display (tmp, runtime, HCBUFSIZ_TINY);
|
|
|
|
|
2017-03-25 15:11:01 +00:00
|
|
|
event_log_info (hashcat_ctx, "Dictionary cache built:");
|
|
|
|
event_log_info (hashcat_ctx, "* Filename..: %s", cache_generate->dictfile);
|
2017-10-20 10:19:33 +00:00
|
|
|
event_log_info (hashcat_ctx, "* Passwords.: %" PRIu64, cache_generate->cnt2);
|
|
|
|
event_log_info (hashcat_ctx, "* Bytes.....: %" PRId64, cache_generate->comp);
|
|
|
|
event_log_info (hashcat_ctx, "* Keyspace..: %" PRIu64, cache_generate->cnt);
|
2017-05-23 08:07:04 +00:00
|
|
|
event_log_info (hashcat_ctx, "* Runtime...: %s", runtime);
|
2017-02-10 18:46:52 +00:00
|
|
|
event_log_info (hashcat_ctx, NULL);
|
2017-05-23 08:07:04 +00:00
|
|
|
|
|
|
|
hcfree (runtime);
|
2016-10-23 12:06:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-21 08:03:06 +00:00
|
|
|
static void main_hashconfig_pre (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYBE_UNUSED const void *buf, MAYBE_UNUSED const size_t len)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static void main_hashconfig_post (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYBE_UNUSED const void *buf, MAYBE_UNUSED const size_t len)
|
|
|
|
{
|
2019-11-22 18:10:56 +00:00
|
|
|
const hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
|
|
|
|
const user_options_t *user_options = hashcat_ctx->user_options;
|
|
|
|
|
|
|
|
if (user_options->quiet == true) return;
|
2019-11-21 08:03:06 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Optimizer constraints
|
|
|
|
*/
|
|
|
|
|
|
|
|
event_log_info (hashcat_ctx, "Minimum password length supported by kernel: %u", hashconfig->pw_min);
|
|
|
|
event_log_info (hashcat_ctx, "Maximum password length supported by kernel: %u", hashconfig->pw_max);
|
|
|
|
|
|
|
|
if (hashconfig->is_salted == true)
|
|
|
|
{
|
|
|
|
if (hashconfig->opti_type & OPTI_TYPE_RAW_HASH)
|
|
|
|
{
|
2023-07-27 14:18:35 +00:00
|
|
|
event_log_info (hashcat_ctx, "Minimum salt length supported by kernel: %u", hashconfig->salt_min);
|
2019-11-21 08:03:06 +00:00
|
|
|
event_log_info (hashcat_ctx, "Maximum salt length supported by kernel: %u", hashconfig->salt_max);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
event_log_info (hashcat_ctx, NULL);
|
|
|
|
}
|
|
|
|
|
2016-10-23 12:49:40 +00:00
|
|
|
static void main_hashlist_count_lines_pre (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYBE_UNUSED const void *buf, MAYBE_UNUSED const size_t len)
|
|
|
|
{
|
|
|
|
const user_options_t *user_options = hashcat_ctx->user_options;
|
|
|
|
|
|
|
|
if (user_options->quiet == true) return;
|
|
|
|
|
2017-11-14 04:46:26 +00:00
|
|
|
const char *hashfile = (const char *) buf;
|
2016-10-23 12:49:40 +00:00
|
|
|
|
2021-06-22 09:37:59 +00:00
|
|
|
event_log_info_nn (hashcat_ctx, "Counting lines in %s. Please be patient...", hashfile);
|
2016-10-23 12:49:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void main_hashlist_count_lines_post (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYBE_UNUSED const void *buf, MAYBE_UNUSED const size_t len)
|
|
|
|
{
|
|
|
|
const user_options_t *user_options = hashcat_ctx->user_options;
|
|
|
|
|
|
|
|
if (user_options->quiet == true) return;
|
|
|
|
|
2017-11-14 04:46:26 +00:00
|
|
|
const char *hashfile = (const char *) buf;
|
2016-10-23 12:49:40 +00:00
|
|
|
|
2021-06-22 09:37:59 +00:00
|
|
|
event_log_info_nn (hashcat_ctx, "Counted lines in %s", hashfile);
|
2016-10-23 12:49:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void main_hashlist_parse_hash (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYBE_UNUSED const void *buf, MAYBE_UNUSED const size_t len)
|
|
|
|
{
|
|
|
|
const user_options_t *user_options = hashcat_ctx->user_options;
|
|
|
|
|
|
|
|
if (user_options->quiet == true) return;
|
|
|
|
|
2017-11-14 04:46:26 +00:00
|
|
|
const hashlist_parse_t *hashlist_parse = (const hashlist_parse_t *) buf;
|
2016-10-23 12:49:40 +00:00
|
|
|
|
2018-02-08 18:13:29 +00:00
|
|
|
const u64 hashes_cnt = hashlist_parse->hashes_cnt;
|
|
|
|
const u64 hashes_avail = hashlist_parse->hashes_avail;
|
2016-10-23 12:49:40 +00:00
|
|
|
|
|
|
|
if (hashes_cnt < hashes_avail)
|
|
|
|
{
|
2018-02-08 18:13:29 +00:00
|
|
|
event_log_info_nn (hashcat_ctx, "Parsing Hashes: %" PRIu64 "/%" PRIu64 " (%0.2f%%)...", hashes_cnt, hashes_avail, ((double) hashes_cnt / hashes_avail) * 100.0);
|
2016-10-23 12:49:40 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-02-08 18:13:29 +00:00
|
|
|
event_log_info_nn (hashcat_ctx, "Parsed Hashes: %" PRIu64 "/%" PRIu64 " (%0.2f%%)", hashes_cnt, hashes_avail, 100.0);
|
2016-10-23 12:49:40 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void main_hashlist_sort_hash_pre (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYBE_UNUSED const void *buf, MAYBE_UNUSED const size_t len)
|
|
|
|
{
|
|
|
|
const user_options_t *user_options = hashcat_ctx->user_options;
|
|
|
|
|
|
|
|
if (user_options->quiet == true) return;
|
|
|
|
|
2021-06-22 09:37:59 +00:00
|
|
|
event_log_info_nn (hashcat_ctx, "Sorting hashes. Please be patient...");
|
2016-10-23 12:49:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void main_hashlist_sort_hash_post (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYBE_UNUSED const void *buf, MAYBE_UNUSED const size_t len)
|
|
|
|
{
|
|
|
|
const user_options_t *user_options = hashcat_ctx->user_options;
|
|
|
|
|
|
|
|
if (user_options->quiet == true) return;
|
|
|
|
|
2021-06-22 09:37:59 +00:00
|
|
|
event_log_info_nn (hashcat_ctx, "Sorted hashes");
|
2016-10-23 12:49:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void main_hashlist_unique_hash_pre (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYBE_UNUSED const void *buf, MAYBE_UNUSED const size_t len)
|
|
|
|
{
|
|
|
|
const user_options_t *user_options = hashcat_ctx->user_options;
|
|
|
|
|
|
|
|
if (user_options->quiet == true) return;
|
|
|
|
|
2021-06-22 09:37:59 +00:00
|
|
|
event_log_info_nn (hashcat_ctx, "Removing duplicate hashes. Please be patient...");
|
2016-10-23 12:49:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void main_hashlist_unique_hash_post (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYBE_UNUSED const void *buf, MAYBE_UNUSED const size_t len)
|
|
|
|
{
|
|
|
|
const user_options_t *user_options = hashcat_ctx->user_options;
|
|
|
|
|
|
|
|
if (user_options->quiet == true) return;
|
|
|
|
|
2021-06-22 09:37:59 +00:00
|
|
|
event_log_info_nn (hashcat_ctx, "Removed duplicate hashes");
|
2016-10-23 12:49:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void main_hashlist_sort_salt_pre (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYBE_UNUSED const void *buf, MAYBE_UNUSED const size_t len)
|
|
|
|
{
|
|
|
|
const user_options_t *user_options = hashcat_ctx->user_options;
|
|
|
|
|
|
|
|
if (user_options->quiet == true) return;
|
|
|
|
|
2021-06-22 09:37:59 +00:00
|
|
|
event_log_info_nn (hashcat_ctx, "Sorting salts. Please be patient...");
|
2016-10-23 12:49:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void main_hashlist_sort_salt_post (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYBE_UNUSED const void *buf, MAYBE_UNUSED const size_t len)
|
|
|
|
{
|
|
|
|
const user_options_t *user_options = hashcat_ctx->user_options;
|
|
|
|
|
|
|
|
if (user_options->quiet == true) return;
|
|
|
|
|
2021-06-22 09:37:59 +00:00
|
|
|
event_log_info_nn (hashcat_ctx, "Sorted salts");
|
|
|
|
}
|
|
|
|
|
|
|
|
static void main_autodetect_starting (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYBE_UNUSED const void *buf, MAYBE_UNUSED const size_t len)
|
|
|
|
{
|
|
|
|
const user_options_t *user_options = hashcat_ctx->user_options;
|
|
|
|
|
|
|
|
if (user_options->quiet == true) return;
|
|
|
|
|
|
|
|
event_log_info_nn (hashcat_ctx, "Autodetecting hash-modes. Please be patient...");
|
|
|
|
}
|
|
|
|
|
|
|
|
static void main_autodetect_finished (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYBE_UNUSED const void *buf, MAYBE_UNUSED const size_t len)
|
|
|
|
{
|
|
|
|
const user_options_t *user_options = hashcat_ctx->user_options;
|
|
|
|
|
|
|
|
if (user_options->quiet == true) return;
|
|
|
|
|
|
|
|
event_log_info_nn (hashcat_ctx, "Autodetected hash-modes");
|
|
|
|
}
|
|
|
|
|
|
|
|
static void main_selftest_starting (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYBE_UNUSED const void *buf, MAYBE_UNUSED const size_t len)
|
|
|
|
{
|
|
|
|
const user_options_t *user_options = hashcat_ctx->user_options;
|
|
|
|
|
|
|
|
if (user_options->quiet == true) return;
|
|
|
|
|
|
|
|
event_log_info_nn (hashcat_ctx, "Starting self-test. Please be patient...");
|
|
|
|
}
|
|
|
|
|
|
|
|
static void main_selftest_finished (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYBE_UNUSED const void *buf, MAYBE_UNUSED const size_t len)
|
|
|
|
{
|
|
|
|
const user_options_t *user_options = hashcat_ctx->user_options;
|
|
|
|
|
|
|
|
if (user_options->quiet == true) return;
|
|
|
|
|
|
|
|
event_log_info_nn (hashcat_ctx, "Finished self-test");
|
2016-10-23 12:49:40 +00:00
|
|
|
}
|
|
|
|
|
2021-08-05 15:18:10 +00:00
|
|
|
static void main_autotune_starting (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYBE_UNUSED const void *buf, MAYBE_UNUSED const size_t len)
|
|
|
|
{
|
|
|
|
const user_options_t *user_options = hashcat_ctx->user_options;
|
|
|
|
|
|
|
|
if (user_options->quiet == true) return;
|
|
|
|
|
|
|
|
event_log_info_nn (hashcat_ctx, "Starting autotune. Please be patient...");
|
|
|
|
}
|
|
|
|
|
|
|
|
static void main_autotune_finished (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYBE_UNUSED const void *buf, MAYBE_UNUSED const size_t len)
|
|
|
|
{
|
|
|
|
const user_options_t *user_options = hashcat_ctx->user_options;
|
|
|
|
|
|
|
|
if (user_options->quiet == true) return;
|
|
|
|
|
|
|
|
event_log_info_nn (hashcat_ctx, "Finished autotune");
|
|
|
|
}
|
|
|
|
|
2016-10-30 17:55:27 +00:00
|
|
|
static void event (const u32 id, hashcat_ctx_t *hashcat_ctx, const void *buf, const size_t len)
|
2016-10-07 14:56:44 +00:00
|
|
|
{
|
2016-10-08 21:16:40 +00:00
|
|
|
switch (id)
|
2016-10-07 14:56:44 +00:00
|
|
|
{
|
2021-08-05 15:18:10 +00:00
|
|
|
case EVENT_AUTOTUNE_FINISHED: main_autotune_finished (hashcat_ctx, buf, len); break;
|
|
|
|
case EVENT_AUTOTUNE_STARTING: main_autotune_starting (hashcat_ctx, buf, len); break;
|
2021-06-22 09:37:59 +00:00
|
|
|
case EVENT_SELFTEST_FINISHED: main_selftest_finished (hashcat_ctx, buf, len); break;
|
|
|
|
case EVENT_SELFTEST_STARTING: main_selftest_starting (hashcat_ctx, buf, len); break;
|
|
|
|
case EVENT_AUTODETECT_FINISHED: main_autodetect_finished (hashcat_ctx, buf, len); break;
|
|
|
|
case EVENT_AUTODETECT_STARTING: main_autodetect_starting (hashcat_ctx, buf, len); break;
|
2016-10-25 10:03:20 +00:00
|
|
|
case EVENT_BITMAP_INIT_POST: main_bitmap_init_post (hashcat_ctx, buf, len); break;
|
|
|
|
case EVENT_BITMAP_INIT_PRE: main_bitmap_init_pre (hashcat_ctx, buf, len); break;
|
2018-11-04 09:07:45 +00:00
|
|
|
case EVENT_BITMAP_FINAL_OVERFLOW: main_bitmap_final_overflow (hashcat_ctx, buf, len); break;
|
2016-10-25 10:03:20 +00:00
|
|
|
case EVENT_CALCULATED_WORDS_BASE: main_calculated_words_base (hashcat_ctx, buf, len); break;
|
|
|
|
case EVENT_CRACKER_FINISHED: main_cracker_finished (hashcat_ctx, buf, len); break;
|
|
|
|
case EVENT_CRACKER_HASH_CRACKED: main_cracker_hash_cracked (hashcat_ctx, buf, len); break;
|
|
|
|
case EVENT_CRACKER_STARTING: main_cracker_starting (hashcat_ctx, buf, len); break;
|
2019-11-21 08:03:06 +00:00
|
|
|
case EVENT_HASHCONFIG_PRE: main_hashconfig_pre (hashcat_ctx, buf, len); break;
|
|
|
|
case EVENT_HASHCONFIG_POST: main_hashconfig_post (hashcat_ctx, buf, len); break;
|
2016-10-25 10:03:20 +00:00
|
|
|
case EVENT_HASHLIST_COUNT_LINES_POST: main_hashlist_count_lines_post (hashcat_ctx, buf, len); break;
|
|
|
|
case EVENT_HASHLIST_COUNT_LINES_PRE: main_hashlist_count_lines_pre (hashcat_ctx, buf, len); break;
|
|
|
|
case EVENT_HASHLIST_PARSE_HASH: main_hashlist_parse_hash (hashcat_ctx, buf, len); break;
|
|
|
|
case EVENT_HASHLIST_SORT_HASH_POST: main_hashlist_sort_hash_post (hashcat_ctx, buf, len); break;
|
|
|
|
case EVENT_HASHLIST_SORT_HASH_PRE: main_hashlist_sort_hash_pre (hashcat_ctx, buf, len); break;
|
|
|
|
case EVENT_HASHLIST_SORT_SALT_POST: main_hashlist_sort_salt_post (hashcat_ctx, buf, len); break;
|
|
|
|
case EVENT_HASHLIST_SORT_SALT_PRE: main_hashlist_sort_salt_pre (hashcat_ctx, buf, len); break;
|
|
|
|
case EVENT_HASHLIST_UNIQUE_HASH_POST: main_hashlist_unique_hash_post (hashcat_ctx, buf, len); break;
|
|
|
|
case EVENT_HASHLIST_UNIQUE_HASH_PRE: main_hashlist_unique_hash_pre (hashcat_ctx, buf, len); break;
|
|
|
|
case EVENT_LOG_ERROR: main_log_error (hashcat_ctx, buf, len); break;
|
2016-10-12 09:27:10 +00:00
|
|
|
case EVENT_LOG_INFO: main_log_info (hashcat_ctx, buf, len); break;
|
|
|
|
case EVENT_LOG_WARNING: main_log_warning (hashcat_ctx, buf, len); break;
|
2017-03-25 19:50:37 +00:00
|
|
|
case EVENT_LOG_ADVICE: main_log_advice (hashcat_ctx, buf, len); break;
|
2016-10-25 10:03:20 +00:00
|
|
|
case EVENT_MONITOR_RUNTIME_LIMIT: main_monitor_runtime_limit (hashcat_ctx, buf, len); break;
|
|
|
|
case EVENT_MONITOR_STATUS_REFRESH: main_monitor_status_refresh (hashcat_ctx, buf, len); break;
|
|
|
|
case EVENT_MONITOR_TEMP_ABORT: main_monitor_temp_abort (hashcat_ctx, buf, len); break;
|
|
|
|
case EVENT_MONITOR_THROTTLE1: main_monitor_throttle1 (hashcat_ctx, buf, len); break;
|
|
|
|
case EVENT_MONITOR_THROTTLE2: main_monitor_throttle2 (hashcat_ctx, buf, len); break;
|
|
|
|
case EVENT_MONITOR_THROTTLE3: main_monitor_throttle3 (hashcat_ctx, buf, len); break;
|
2016-11-21 17:30:36 +00:00
|
|
|
case EVENT_MONITOR_PERFORMANCE_HINT: main_monitor_performance_hint (hashcat_ctx, buf, len); break;
|
2018-10-17 08:55:47 +00:00
|
|
|
case EVENT_MONITOR_NOINPUT_HINT: main_monitor_noinput_hint (hashcat_ctx, buf, len); break;
|
|
|
|
case EVENT_MONITOR_NOINPUT_ABORT: main_monitor_noinput_abort (hashcat_ctx, buf, len); break;
|
2019-05-01 13:52:56 +00:00
|
|
|
case EVENT_BACKEND_SESSION_POST: main_backend_session_post (hashcat_ctx, buf, len); break;
|
|
|
|
case EVENT_BACKEND_SESSION_PRE: main_backend_session_pre (hashcat_ctx, buf, len); break;
|
2019-05-10 14:37:49 +00:00
|
|
|
case EVENT_BACKEND_SESSION_HOSTMEM: main_backend_session_hostmem (hashcat_ctx, buf, len); break;
|
2019-05-01 13:52:56 +00:00
|
|
|
case EVENT_BACKEND_DEVICE_INIT_POST: main_backend_device_init_post (hashcat_ctx, buf, len); break;
|
|
|
|
case EVENT_BACKEND_DEVICE_INIT_PRE: main_backend_device_init_pre (hashcat_ctx, buf, len); break;
|
2016-10-14 17:25:13 +00:00
|
|
|
case EVENT_OUTERLOOP_FINISHED: main_outerloop_finished (hashcat_ctx, buf, len); break;
|
|
|
|
case EVENT_OUTERLOOP_MAINSCREEN: main_outerloop_mainscreen (hashcat_ctx, buf, len); break;
|
2016-10-25 10:03:20 +00:00
|
|
|
case EVENT_OUTERLOOP_STARTING: main_outerloop_starting (hashcat_ctx, buf, len); break;
|
|
|
|
case EVENT_POTFILE_ALL_CRACKED: main_potfile_all_cracked (hashcat_ctx, buf, len); break;
|
2016-10-19 10:42:41 +00:00
|
|
|
case EVENT_POTFILE_HASH_LEFT: main_potfile_hash_left (hashcat_ctx, buf, len); break;
|
2016-10-25 10:03:20 +00:00
|
|
|
case EVENT_POTFILE_HASH_SHOW: main_potfile_hash_show (hashcat_ctx, buf, len); break;
|
2016-10-12 09:27:10 +00:00
|
|
|
case EVENT_POTFILE_NUM_CRACKED: main_potfile_num_cracked (hashcat_ctx, buf, len); break;
|
2016-10-25 10:03:20 +00:00
|
|
|
case EVENT_POTFILE_REMOVE_PARSE_POST: main_potfile_remove_parse_post (hashcat_ctx, buf, len); break;
|
|
|
|
case EVENT_POTFILE_REMOVE_PARSE_PRE: main_potfile_remove_parse_pre (hashcat_ctx, buf, len); break;
|
2023-03-11 08:55:37 +00:00
|
|
|
case EVENT_RULESFILES_PARSE_POST: main_rulesfiles_parse_post (hashcat_ctx, buf, len); break;
|
|
|
|
case EVENT_RULESFILES_PARSE_PRE: main_rulesfiles_parse_pre (hashcat_ctx, buf, len); break;
|
2016-10-12 09:27:10 +00:00
|
|
|
case EVENT_SET_KERNEL_POWER_FINAL: main_set_kernel_power_final (hashcat_ctx, buf, len); break;
|
2016-10-23 12:06:52 +00:00
|
|
|
case EVENT_WORDLIST_CACHE_GENERATE: main_wordlist_cache_generate (hashcat_ctx, buf, len); break;
|
2016-10-25 10:03:20 +00:00
|
|
|
case EVENT_WORDLIST_CACHE_HIT: main_wordlist_cache_hit (hashcat_ctx, buf, len); break;
|
2016-10-07 14:56:44 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-10-02 23:27:55 +00:00
|
|
|
int main (int argc, char **argv)
|
|
|
|
{
|
2018-06-22 07:57:44 +00:00
|
|
|
// this increases the size on windows dos boxes
|
2016-10-23 15:31:22 +00:00
|
|
|
|
|
|
|
setup_console ();
|
|
|
|
|
2017-12-10 00:40:45 +00:00
|
|
|
const time_t proc_start = time (NULL);
|
2016-10-23 15:31:22 +00:00
|
|
|
|
2016-10-14 17:25:13 +00:00
|
|
|
// hashcat main context
|
|
|
|
|
2018-01-31 15:40:01 +00:00
|
|
|
hashcat_ctx_t *hashcat_ctx = (hashcat_ctx_t *) hcmalloc (sizeof (hashcat_ctx_t));
|
2016-10-14 17:25:13 +00:00
|
|
|
|
2019-07-13 05:27:32 +00:00
|
|
|
if (hashcat_init (hashcat_ctx, event) == -1)
|
2019-07-10 15:27:45 +00:00
|
|
|
{
|
|
|
|
hcfree (hashcat_ctx);
|
2016-10-14 17:25:13 +00:00
|
|
|
|
2019-07-10 15:27:45 +00:00
|
|
|
return -1;
|
|
|
|
}
|
2016-10-07 19:47:11 +00:00
|
|
|
// install and shared folder need to be set to recognize "make install" use
|
2016-10-02 23:27:55 +00:00
|
|
|
|
2017-04-10 20:35:01 +00:00
|
|
|
const char *install_folder = NULL;
|
|
|
|
const char *shared_folder = NULL;
|
2016-10-02 23:27:55 +00:00
|
|
|
|
2016-10-07 19:47:11 +00:00
|
|
|
#if defined (INSTALL_FOLDER)
|
|
|
|
install_folder = INSTALL_FOLDER;
|
|
|
|
#endif
|
2016-10-02 23:27:55 +00:00
|
|
|
|
2016-10-07 19:47:11 +00:00
|
|
|
#if defined (SHARED_FOLDER)
|
|
|
|
shared_folder = SHARED_FOLDER;
|
|
|
|
#endif
|
2016-10-02 23:27:55 +00:00
|
|
|
|
2016-10-14 17:25:13 +00:00
|
|
|
// initialize the user options with some defaults (you can override them later)
|
2016-10-02 23:27:55 +00:00
|
|
|
|
2019-07-13 05:27:32 +00:00
|
|
|
if (user_options_init (hashcat_ctx) == -1)
|
2019-07-10 15:27:45 +00:00
|
|
|
{
|
2021-08-07 16:21:39 +00:00
|
|
|
hashcat_destroy (hashcat_ctx);
|
|
|
|
|
2019-07-10 15:27:45 +00:00
|
|
|
hcfree (hashcat_ctx);
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
2016-10-06 18:57:29 +00:00
|
|
|
|
2016-10-07 19:47:11 +00:00
|
|
|
// parse commandline parameters and check them
|
2016-10-06 18:57:29 +00:00
|
|
|
|
2019-07-13 05:27:32 +00:00
|
|
|
if (user_options_getopt (hashcat_ctx, argc, argv) == -1)
|
2019-07-10 15:27:45 +00:00
|
|
|
{
|
2021-08-07 16:21:39 +00:00
|
|
|
user_options_destroy (hashcat_ctx);
|
|
|
|
|
|
|
|
hashcat_destroy (hashcat_ctx);
|
|
|
|
|
2019-07-10 15:27:45 +00:00
|
|
|
hcfree (hashcat_ctx);
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
2016-10-02 23:27:55 +00:00
|
|
|
|
2019-07-13 05:27:32 +00:00
|
|
|
if (user_options_sanity (hashcat_ctx) == -1)
|
2019-07-10 15:27:45 +00:00
|
|
|
{
|
2021-08-07 16:21:39 +00:00
|
|
|
user_options_destroy (hashcat_ctx);
|
|
|
|
|
|
|
|
hashcat_destroy (hashcat_ctx);
|
|
|
|
|
2019-07-10 15:27:45 +00:00
|
|
|
hcfree (hashcat_ctx);
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
2016-10-02 23:27:55 +00:00
|
|
|
|
2016-10-07 19:47:11 +00:00
|
|
|
// some early exits
|
2016-10-02 23:27:55 +00:00
|
|
|
|
2016-10-07 19:47:11 +00:00
|
|
|
user_options_t *user_options = hashcat_ctx->user_options;
|
2016-10-02 23:27:55 +00:00
|
|
|
|
2018-10-28 15:47:13 +00:00
|
|
|
#ifdef WITH_BRAIN
|
|
|
|
if (user_options->brain_server == true)
|
|
|
|
{
|
2020-01-11 09:46:11 +00:00
|
|
|
const int rc = brain_server (user_options->brain_host, user_options->brain_port, user_options->brain_password, user_options->brain_session_whitelist, user_options->brain_server_timer);
|
2018-10-28 15:47:13 +00:00
|
|
|
|
2019-07-10 15:27:45 +00:00
|
|
|
hcfree (hashcat_ctx);
|
|
|
|
|
2018-10-28 15:47:13 +00:00
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2016-10-07 19:47:11 +00:00
|
|
|
if (user_options->version == true)
|
|
|
|
{
|
|
|
|
printf ("%s\n", VERSION_TAG);
|
2016-10-06 14:40:29 +00:00
|
|
|
|
2021-08-07 16:21:39 +00:00
|
|
|
user_options_destroy (hashcat_ctx);
|
|
|
|
|
|
|
|
hashcat_destroy (hashcat_ctx);
|
|
|
|
|
2019-07-10 15:27:45 +00:00
|
|
|
hcfree (hashcat_ctx);
|
|
|
|
|
2016-10-07 19:47:11 +00:00
|
|
|
return 0;
|
|
|
|
}
|
2016-10-02 23:27:55 +00:00
|
|
|
|
2019-05-01 13:52:56 +00:00
|
|
|
// init a hashcat session; this initializes backend devices, hwmon, etc
|
2016-10-23 15:31:22 +00:00
|
|
|
|
|
|
|
welcome_screen (hashcat_ctx, VERSION_TAG);
|
2016-10-02 23:27:55 +00:00
|
|
|
|
2016-10-23 15:31:22 +00:00
|
|
|
int rc_final = -1;
|
|
|
|
|
2019-07-13 05:27:32 +00:00
|
|
|
if (hashcat_session_init (hashcat_ctx, install_folder, shared_folder, argc, argv, COMPTIME) == 0)
|
2016-10-23 15:31:22 +00:00
|
|
|
{
|
2023-05-01 15:38:42 +00:00
|
|
|
if (user_options->usage > 0)
|
2019-01-06 12:23:45 +00:00
|
|
|
{
|
|
|
|
usage_big_print (hashcat_ctx);
|
|
|
|
|
|
|
|
rc_final = 0;
|
|
|
|
}
|
2020-12-29 03:58:58 +00:00
|
|
|
else if (user_options->hash_info == true)
|
|
|
|
{
|
|
|
|
hash_info (hashcat_ctx);
|
|
|
|
|
|
|
|
rc_final = 0;
|
|
|
|
}
|
2022-02-13 11:33:11 +00:00
|
|
|
else if (user_options->backend_info > 0)
|
2016-10-25 14:40:06 +00:00
|
|
|
{
|
2019-05-01 13:52:56 +00:00
|
|
|
// if this is just backend_info, no need to execute some real cracking session
|
2016-10-25 14:40:06 +00:00
|
|
|
|
2019-05-01 13:52:56 +00:00
|
|
|
backend_info (hashcat_ctx);
|
2016-10-23 15:31:22 +00:00
|
|
|
|
2016-10-25 14:40:06 +00:00
|
|
|
rc_final = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// now execute hashcat
|
|
|
|
|
2019-05-01 13:52:56 +00:00
|
|
|
backend_info_compact (hashcat_ctx);
|
2016-10-26 09:24:00 +00:00
|
|
|
|
2017-10-14 10:54:34 +00:00
|
|
|
user_options_info (hashcat_ctx);
|
|
|
|
|
2016-10-25 14:40:06 +00:00
|
|
|
rc_final = hashcat_session_execute (hashcat_ctx);
|
|
|
|
}
|
2016-10-23 15:31:22 +00:00
|
|
|
}
|
|
|
|
|
2019-05-01 13:52:56 +00:00
|
|
|
// finish the hashcat session, this shuts down backend devices, hwmon, etc
|
2016-10-23 15:31:22 +00:00
|
|
|
|
|
|
|
hashcat_session_destroy (hashcat_ctx);
|
2016-10-02 23:27:55 +00:00
|
|
|
|
2016-10-14 17:25:13 +00:00
|
|
|
// finished with hashcat, clean up
|
2016-10-02 23:27:55 +00:00
|
|
|
|
2017-12-10 00:40:45 +00:00
|
|
|
const time_t proc_stop = time (NULL);
|
2016-10-23 15:31:22 +00:00
|
|
|
|
|
|
|
goodbye_screen (hashcat_ctx, proc_start, proc_stop);
|
|
|
|
|
2016-10-16 17:32:43 +00:00
|
|
|
hashcat_destroy (hashcat_ctx);
|
2016-10-02 23:27:55 +00:00
|
|
|
|
2019-07-10 15:27:45 +00:00
|
|
|
hcfree (hashcat_ctx);
|
2016-10-02 23:27:55 +00:00
|
|
|
|
2016-10-23 15:31:22 +00:00
|
|
|
return rc_final;
|
2016-10-07 14:56:44 +00:00
|
|
|
}
|