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); +} +