mirror of
https://github.com/hashcat/hashcat.git
synced 2024-12-23 15:18:16 +00:00
Destinguish between EVENT_POTFILE_HASH_CRACKED and EVENT_CRACKER_HASH_CRACKED for prompt handling
This commit is contained in:
parent
2005f5d193
commit
1f72aa95e6
@ -105,8 +105,9 @@ typedef enum event_identifier
|
||||
EVENT_CRACKER_HASH_CRACKED = 0x00000058,
|
||||
EVENT_POTFILE_REMOVE_PARSE_PRE = 0x00000061,
|
||||
EVENT_POTFILE_REMOVE_PARSE_POST = 0x00000062,
|
||||
EVENT_POTFILE_NUM_CRACKED = 0x00000063,
|
||||
EVENT_POTFILE_ALL_CRACKED = 0x00000064,
|
||||
EVENT_POTFILE_HASH_CRACKED = 0x00000063,
|
||||
EVENT_POTFILE_NUM_CRACKED = 0x00000064,
|
||||
EVENT_POTFILE_ALL_CRACKED = 0x00000065,
|
||||
EVENT_OPENCL_SESSION_PRE = 0x00000071,
|
||||
EVENT_OPENCL_SESSION_POST = 0x00000072,
|
||||
EVENT_BITMAP_INIT_PRE = 0x00000081,
|
||||
|
20
src/hashes.c
20
src/hashes.c
@ -21,7 +21,6 @@
|
||||
#include "potfile.h"
|
||||
#include "rp.h"
|
||||
#include "rp_kernel_on_cpu.h"
|
||||
#include "terminal.h"
|
||||
#include "thread.h"
|
||||
#include "timer.h"
|
||||
|
||||
@ -219,12 +218,8 @@ int save_hash (hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
void check_hash (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, plain_t *plain)
|
||||
{
|
||||
debugfile_ctx_t *debugfile_ctx = hashcat_ctx->debugfile_ctx;
|
||||
loopback_ctx_t *loopback_ctx = hashcat_ctx->loopback_ctx;
|
||||
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;
|
||||
debugfile_ctx_t *debugfile_ctx = hashcat_ctx->debugfile_ctx;
|
||||
loopback_ctx_t *loopback_ctx = hashcat_ctx->loopback_ctx;
|
||||
|
||||
const u32 salt_pos = plain->salt_pos;
|
||||
const u32 digest_pos = plain->digest_pos; // relative
|
||||
@ -270,8 +265,6 @@ void check_hash (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, pl
|
||||
|
||||
outfile_write_open (hashcat_ctx);
|
||||
|
||||
if (outfile_ctx->filename == NULL) if (user_options->quiet == false) clear_prompt ();
|
||||
|
||||
char tmp_buf[HCBUFSIZ_LARGE];
|
||||
|
||||
const int tmp_len = outfile_write (hashcat_ctx, out_buf, plain_ptr, plain_len, crackpos, NULL, 0, tmp_buf);
|
||||
@ -280,17 +273,8 @@ void check_hash (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, pl
|
||||
|
||||
EVENT_DATA (EVENT_CRACKER_HASH_CRACKED, tmp_buf, tmp_len);
|
||||
|
||||
if ((user_options_extra->wordlist_mode == WL_MODE_FILE) || (user_options_extra->wordlist_mode == WL_MODE_MASK))
|
||||
{
|
||||
if ((status_ctx->devices_status != STATUS_CRACKED) && (user_options->status != true))
|
||||
{
|
||||
if (outfile_ctx->filename == NULL) if (user_options->quiet == false) send_prompt ();
|
||||
}
|
||||
}
|
||||
|
||||
// if enabled, update also the loopback file
|
||||
|
||||
|
||||
if (loopback_ctx->fp != NULL)
|
||||
{
|
||||
loopback_write_append (hashcat_ctx, plain_ptr, plain_len);
|
||||
|
29
src/main.c
29
src/main.c
@ -292,12 +292,28 @@ static void main_cracker_finished (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYB
|
||||
|
||||
static void main_cracker_hash_cracked (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;
|
||||
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;
|
||||
|
||||
if (outfile_ctx->fp != NULL) return; // cracked hash was not written to an outfile
|
||||
|
||||
if ((user_options_extra->wordlist_mode == WL_MODE_FILE) || (user_options_extra->wordlist_mode == WL_MODE_MASK))
|
||||
{
|
||||
if (outfile_ctx->filename == NULL) if (user_options->quiet == false) clear_prompt ();
|
||||
}
|
||||
|
||||
fwrite (buf, len, 1, stdout);
|
||||
fwrite (EOL, strlen (EOL), 1, stdout);
|
||||
|
||||
if ((user_options_extra->wordlist_mode == WL_MODE_FILE) || (user_options_extra->wordlist_mode == WL_MODE_MASK))
|
||||
{
|
||||
if (status_ctx->devices_status != STATUS_CRACKED)
|
||||
{
|
||||
if (outfile_ctx->filename == NULL) if (user_options->quiet == false) send_prompt ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void main_calculated_words_base (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYBE_UNUSED const void *buf, MAYBE_UNUSED const size_t len)
|
||||
@ -328,6 +344,16 @@ static void main_potfile_remove_parse_post (MAYBE_UNUSED hashcat_ctx_t *hashcat_
|
||||
event_log_info_nn (hashcat_ctx, "Compared hashes with potfile entries...");
|
||||
}
|
||||
|
||||
static void main_potfile_hash_cracked (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;
|
||||
|
||||
if (outfile_ctx->fp != NULL) return; // cracked hash was not written to an outfile
|
||||
|
||||
fwrite (buf, len, 1, stdout);
|
||||
fwrite (EOL, strlen (EOL), 1, stdout);
|
||||
}
|
||||
|
||||
static void main_potfile_num_cracked (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;
|
||||
@ -532,6 +558,7 @@ void event (const u32 id, hashcat_ctx_t *hashcat_ctx, const void *buf, const siz
|
||||
case EVENT_CALCULATED_WORDS_BASE: main_calculated_words_base (hashcat_ctx, buf, len); break;
|
||||
case EVENT_POTFILE_REMOVE_PARSE_PRE: main_potfile_remove_parse_pre (hashcat_ctx, buf, len); break;
|
||||
case EVENT_POTFILE_REMOVE_PARSE_POST: main_potfile_remove_parse_post (hashcat_ctx, buf, len); break;
|
||||
case EVENT_POTFILE_HASH_CRACKED: main_potfile_hash_cracked (hashcat_ctx, buf, len); break;
|
||||
case EVENT_POTFILE_NUM_CRACKED: main_potfile_num_cracked (hashcat_ctx, buf, len); break;
|
||||
case EVENT_POTFILE_ALL_CRACKED: main_potfile_all_cracked (hashcat_ctx, buf, len); break;
|
||||
case EVENT_OPENCL_SESSION_PRE: main_opencl_session_pre (hashcat_ctx, buf, len); break;
|
||||
|
@ -529,7 +529,7 @@ void potfile_show_request (hashcat_ctx_t *hashcat_ctx, char *input_buf, int inpu
|
||||
|
||||
const int tmp_len = outfile_write (hashcat_ctx, input_buf, (const unsigned char *) pot_ptr->plain_buf, pot_ptr->plain_len, 0, username, user_len, tmp_buf);
|
||||
|
||||
EVENT_DATA (EVENT_CRACKER_HASH_CRACKED, tmp_buf, tmp_len);
|
||||
EVENT_DATA (EVENT_POTFILE_HASH_CRACKED, tmp_buf, tmp_len);
|
||||
}
|
||||
}
|
||||
|
||||
@ -556,7 +556,7 @@ void potfile_left_request (hashcat_ctx_t *hashcat_ctx, char *input_buf, int inpu
|
||||
|
||||
const int tmp_len = outfile_write (hashcat_ctx, input_buf, NULL, 0, 0, NULL, 0, tmp_buf);
|
||||
|
||||
EVENT_DATA (EVENT_CRACKER_HASH_CRACKED, tmp_buf, tmp_len);
|
||||
EVENT_DATA (EVENT_POTFILE_HASH_CRACKED, tmp_buf, tmp_len);
|
||||
}
|
||||
}
|
||||
|
||||
@ -685,7 +685,7 @@ int potfile_show_request_lm (hashcat_ctx_t *hashcat_ctx, char *input_buf, int in
|
||||
|
||||
const int tmp_len = outfile_write (hashcat_ctx, input_buf, (unsigned char *) pot_ptr.plain_buf, pot_ptr.plain_len, 0, username, user_len, tmp_buf);
|
||||
|
||||
EVENT_DATA (EVENT_CRACKER_HASH_CRACKED, tmp_buf, tmp_len);
|
||||
EVENT_DATA (EVENT_POTFILE_HASH_CRACKED, tmp_buf, tmp_len);
|
||||
|
||||
if (weak_hash_found == 1) hcfree (pot_right_ptr);
|
||||
|
||||
@ -777,7 +777,7 @@ int potfile_left_request_lm (hashcat_ctx_t *hashcat_ctx, char *input_buf, int in
|
||||
|
||||
const int tmp_len = outfile_write (hashcat_ctx, hash_output, NULL, 0, 0, NULL, 0, tmp_buf);
|
||||
|
||||
EVENT_DATA (EVENT_CRACKER_HASH_CRACKED, tmp_buf, tmp_len);
|
||||
EVENT_DATA (EVENT_POTFILE_HASH_CRACKED, tmp_buf, tmp_len);
|
||||
|
||||
hcfree (hash_output);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user