From e93fa254548888158611e9eeb45cf5ed21a760ea Mon Sep 17 00:00:00 2001 From: jsteube Date: Tue, 21 Nov 2017 11:30:39 +0100 Subject: [PATCH] Allow the use of hashcat_init() without a callback function --- src/hashcat.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/hashcat.c b/src/hashcat.c index a9d00d53a..912ce7486 100644 --- a/src/hashcat.c +++ b/src/hashcat.c @@ -811,16 +811,22 @@ static int outer_loop (hashcat_ctx_t *hashcat_ctx) return 0; } + +static void event_stub (MAYBE_UNUSED const u32 id, MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYBE_UNUSED const void *buf, MAYBE_UNUSED const size_t len) +{ + +} + int hashcat_init (hashcat_ctx_t *hashcat_ctx, void (*event) (const u32, struct hashcat_ctx *, const void *, const size_t)) { if (event == NULL) { - fprintf (stderr, "Event callback function is mandatory\n"); - - return -1; + hashcat_ctx->event = event_stub; + } + else + { + hashcat_ctx->event = event; } - - hashcat_ctx->event = event; hashcat_ctx->bitmap_ctx = (bitmap_ctx_t *) hcmalloc (sizeof (bitmap_ctx_t)); hashcat_ctx->combinator_ctx = (combinator_ctx_t *) hcmalloc (sizeof (combinator_ctx_t));