From f1cf902c3510ec338a151886bf82dee30341019e Mon Sep 17 00:00:00 2001 From: jsteube Date: Tue, 27 Sep 2016 20:07:49 +0200 Subject: [PATCH] Add missing combinator files --- include/combinator.h | 15 +++++++++++++++ src/combinator.c | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 include/combinator.h create mode 100644 src/combinator.c diff --git a/include/combinator.h b/include/combinator.h new file mode 100644 index 000000000..beb964c47 --- /dev/null +++ b/include/combinator.h @@ -0,0 +1,15 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#ifndef _COMBINATOR_H +#define _COMBINATOR_H + +#include +#include + +int combinator_ctx_init (combinator_ctx_t *combinator_ctx, const user_options_t *user_options); +void combinator_ctx_destroy (combinator_ctx_t *combinator_ctx); + +#endif // _COMBINATOR_H diff --git a/src/combinator.c b/src/combinator.c new file mode 100644 index 000000000..df21f9797 --- /dev/null +++ b/src/combinator.c @@ -0,0 +1,34 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "memory.h" +#include "logging.h" +#include "combinator.h" +#include "wordlist.h" + +int combinator_ctx_init (combinator_ctx_t *combinator_ctx, const user_options_t *user_options) +{ + memset (combinator_ctx, 0, sizeof (combinator_ctx_t)); + + combinator_ctx->enabled = false; + + if ((user_options->attack_mode != ATTACK_MODE_COMBI) + && (user_options->attack_mode != ATTACK_MODE_HYBRID1) + && (user_options->attack_mode != ATTACK_MODE_HYBRID2)) return 0; + + combinator_ctx->enabled = true; + + return 0; +} + +void combinator_ctx_destroy (combinator_ctx_t *combinator_ctx) +{ + if (combinator_ctx->enabled == false) return; + + myfree (combinator_ctx); +} +