2016-09-24 09:08:35 +00:00
|
|
|
/**
|
|
|
|
* Author......: See docs/credits.txt
|
|
|
|
* License.....: MIT
|
|
|
|
*/
|
|
|
|
|
2023-01-30 14:41:12 +00:00
|
|
|
#ifndef HC_RP_H
|
|
|
|
#define HC_RP_H
|
2016-09-24 09:08:35 +00:00
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
|
2017-08-11 09:15:43 +00:00
|
|
|
#define RP_RULE_SIZE 256
|
|
|
|
#define RP_PASSWORD_SIZE 256
|
2016-09-24 09:08:35 +00:00
|
|
|
|
|
|
|
#define INCR_RULES 10000
|
|
|
|
|
2016-10-06 19:03:10 +00:00
|
|
|
#define RULES_MAX 32
|
2016-09-24 10:05:56 +00:00
|
|
|
#define MAX_KERNEL_RULES (RULES_MAX - 1)
|
2016-09-24 09:08:35 +00:00
|
|
|
|
2021-08-14 09:43:32 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
char *grp_op_nop_selection;
|
|
|
|
char *grp_op_pos_p0_selection;
|
|
|
|
char *grp_op_pos_p1_selection;
|
|
|
|
char *grp_op_chr_selection;
|
|
|
|
char *grp_op_chr_chr_selection;
|
|
|
|
char *grp_op_pos_chr_selection;
|
|
|
|
char *grp_op_pos_pos0_selection;
|
|
|
|
char *grp_op_pos_pos1_selection;
|
|
|
|
|
|
|
|
int grp_op_nop_cnt;
|
|
|
|
int grp_op_pos_p0_cnt;
|
|
|
|
int grp_op_pos_p1_cnt;
|
|
|
|
int grp_op_chr_cnt;
|
|
|
|
int grp_op_chr_chr_cnt;
|
|
|
|
int grp_op_pos_chr_cnt;
|
|
|
|
int grp_op_pos_pos0_cnt;
|
|
|
|
int grp_op_pos_pos1_cnt;
|
|
|
|
|
|
|
|
// 8 if all operator group types used, but can be lower if user is using operator selection options
|
|
|
|
|
|
|
|
int grp_op_alias_buf[8];
|
|
|
|
int grp_op_alias_cnt;
|
|
|
|
|
|
|
|
} rp_gen_ops_t;
|
|
|
|
|
2016-09-24 09:08:35 +00:00
|
|
|
bool class_num (const u8 c);
|
|
|
|
bool class_lower (const u8 c);
|
|
|
|
bool class_upper (const u8 c);
|
|
|
|
bool class_alpha (const u8 c);
|
|
|
|
|
|
|
|
int conv_ctoi (const u8 c);
|
|
|
|
int conv_itoc (const u8 c);
|
|
|
|
|
2021-08-14 09:43:32 +00:00
|
|
|
int generate_random_rule (char rule_buf[RP_RULE_SIZE], const u32 rp_gen_func_min, const u32 rp_gen_func_max, const rp_gen_ops_t *rp_gen_ops);
|
2016-09-24 09:08:35 +00:00
|
|
|
|
2018-07-26 09:41:56 +00:00
|
|
|
bool is_hex_notation (const char *rule_buf, u32 rule_len, u32 rule_pos);
|
2018-06-14 13:08:00 +00:00
|
|
|
|
2016-10-04 04:35:49 +00:00
|
|
|
int cpu_rule_to_kernel_rule (char *rule_buf, u32 rule_len, kernel_rule_t *rule);
|
2016-09-24 09:08:35 +00:00
|
|
|
int kernel_rule_to_cpu_rule (char *rule_buf, kernel_rule_t *rule);
|
|
|
|
|
2016-09-27 11:13:07 +00:00
|
|
|
bool kernel_rules_has_noop (const kernel_rule_t *kernel_rules_buf, const u32 kernel_rules_cnt);
|
2016-09-24 10:05:56 +00:00
|
|
|
|
2016-10-06 19:03:10 +00:00
|
|
|
int kernel_rules_load (hashcat_ctx_t *hashcat_ctx, kernel_rule_t **out_buf, u32 *out_cnt);
|
2021-08-14 09:43:32 +00:00
|
|
|
int kernel_rules_generate (hashcat_ctx_t *hashcat_ctx, kernel_rule_t **out_buf, u32 *out_cnt, const char *rp_gen_func_selection);
|
2016-09-25 12:53:57 +00:00
|
|
|
|
2023-01-30 14:41:12 +00:00
|
|
|
#endif // HC_RP_H
|