mirror of
https://github.com/hashcat/hashcat.git
synced 2024-12-28 17:38:32 +00:00
152 lines
4.2 KiB
C
152 lines
4.2 KiB
C
/**
|
|
* Author......: Jens Steube <jens.steube@gmail.com>
|
|
* License.....: MIT
|
|
*/
|
|
|
|
#define RP_RULE_BUFSIZ 0x100
|
|
|
|
#define RULE_RC_SYNTAX_ERROR -1
|
|
#define RULE_RC_REJECT_ERROR -2
|
|
|
|
#define RULE_OP_MANGLE_NOOP ':'
|
|
#define RULE_OP_MANGLE_LREST 'l'
|
|
#define RULE_OP_MANGLE_UREST 'u'
|
|
#define RULE_OP_MANGLE_LREST_UFIRST 'c'
|
|
#define RULE_OP_MANGLE_UREST_LFIRST 'C'
|
|
#define RULE_OP_MANGLE_TREST 't'
|
|
#define RULE_OP_MANGLE_TOGGLE_AT 'T'
|
|
#define RULE_OP_MANGLE_REVERSE 'r'
|
|
#define RULE_OP_MANGLE_DUPEWORD 'd'
|
|
#define RULE_OP_MANGLE_DUPEWORD_TIMES 'p'
|
|
#define RULE_OP_MANGLE_REFLECT 'f'
|
|
#define RULE_OP_MANGLE_ROTATE_LEFT '{'
|
|
#define RULE_OP_MANGLE_ROTATE_RIGHT '}'
|
|
#define RULE_OP_MANGLE_APPEND '$'
|
|
#define RULE_OP_MANGLE_PREPEND '^'
|
|
#define RULE_OP_MANGLE_DELETE_FIRST '['
|
|
#define RULE_OP_MANGLE_DELETE_LAST ']'
|
|
#define RULE_OP_MANGLE_DELETE_AT 'D'
|
|
#define RULE_OP_MANGLE_EXTRACT 'x'
|
|
#define RULE_OP_MANGLE_OMIT 'O'
|
|
#define RULE_OP_MANGLE_INSERT 'i'
|
|
#define RULE_OP_MANGLE_OVERSTRIKE 'o'
|
|
#define RULE_OP_MANGLE_TRUNCATE_AT '\''
|
|
#define RULE_OP_MANGLE_REPLACE 's'
|
|
#define RULE_OP_MANGLE_PURGECHAR '@'
|
|
#define RULE_OP_MANGLE_TOGGLECASE_REC 'a'
|
|
#define RULE_OP_MANGLE_DUPECHAR_FIRST 'z'
|
|
#define RULE_OP_MANGLE_DUPECHAR_LAST 'Z'
|
|
#define RULE_OP_MANGLE_DUPECHAR_ALL 'q'
|
|
#define RULE_OP_MANGLE_EXTRACT_MEMORY 'X'
|
|
#define RULE_OP_MANGLE_APPEND_MEMORY '4'
|
|
#define RULE_OP_MANGLE_PREPEND_MEMORY '6'
|
|
|
|
#define RULE_OP_MEMORIZE_WORD 'M'
|
|
|
|
#define RULE_OP_REJECT_LESS '<'
|
|
#define RULE_OP_REJECT_GREATER '>'
|
|
#define RULE_OP_REJECT_CONTAIN '!'
|
|
#define RULE_OP_REJECT_NOT_CONTAIN '/'
|
|
#define RULE_OP_REJECT_EQUAL_FIRST '('
|
|
#define RULE_OP_REJECT_EQUAL_LAST ')'
|
|
#define RULE_OP_REJECT_EQUAL_AT '='
|
|
#define RULE_OP_REJECT_CONTAINS '%'
|
|
#define RULE_OP_REJECT_MEMORY 'Q'
|
|
|
|
/* hashcat only */
|
|
#define RULE_OP_MANGLE_SWITCH_FIRST 'k'
|
|
#define RULE_OP_MANGLE_SWITCH_LAST 'K'
|
|
#define RULE_OP_MANGLE_SWITCH_AT '*'
|
|
#define RULE_OP_MANGLE_CHR_SHIFTL 'L'
|
|
#define RULE_OP_MANGLE_CHR_SHIFTR 'R'
|
|
#define RULE_OP_MANGLE_CHR_INCR '+'
|
|
#define RULE_OP_MANGLE_CHR_DECR '-'
|
|
#define RULE_OP_MANGLE_REPLACE_NP1 '.'
|
|
#define RULE_OP_MANGLE_REPLACE_NM1 ','
|
|
#define RULE_OP_MANGLE_DUPEBLOCK_FIRST 'y'
|
|
#define RULE_OP_MANGLE_DUPEBLOCK_LAST 'Y'
|
|
#define RULE_OP_MANGLE_TITLE 'E'
|
|
|
|
static const char grp_op_nop[] =
|
|
{
|
|
RULE_OP_MANGLE_LREST,
|
|
RULE_OP_MANGLE_UREST,
|
|
RULE_OP_MANGLE_LREST_UFIRST,
|
|
RULE_OP_MANGLE_UREST_LFIRST,
|
|
RULE_OP_MANGLE_TREST,
|
|
RULE_OP_MANGLE_REVERSE,
|
|
RULE_OP_MANGLE_DUPEWORD,
|
|
RULE_OP_MANGLE_REFLECT,
|
|
RULE_OP_MANGLE_DELETE_FIRST,
|
|
RULE_OP_MANGLE_DELETE_LAST,
|
|
RULE_OP_MANGLE_ROTATE_LEFT,
|
|
RULE_OP_MANGLE_ROTATE_RIGHT,
|
|
RULE_OP_MANGLE_SWITCH_FIRST,
|
|
RULE_OP_MANGLE_SWITCH_LAST,
|
|
RULE_OP_MANGLE_DUPECHAR_ALL,
|
|
RULE_OP_MANGLE_TITLE,
|
|
RULE_OP_MANGLE_APPEND_MEMORY,
|
|
RULE_OP_MANGLE_PREPEND_MEMORY,
|
|
};
|
|
|
|
static const char grp_op_pos_p0[] =
|
|
{
|
|
RULE_OP_MANGLE_TOGGLE_AT,
|
|
RULE_OP_MANGLE_DELETE_AT,
|
|
RULE_OP_MANGLE_TRUNCATE_AT,
|
|
RULE_OP_MANGLE_CHR_INCR,
|
|
RULE_OP_MANGLE_CHR_DECR,
|
|
RULE_OP_MANGLE_CHR_SHIFTL,
|
|
RULE_OP_MANGLE_CHR_SHIFTR,
|
|
RULE_OP_MANGLE_REPLACE_NP1,
|
|
RULE_OP_MANGLE_REPLACE_NM1
|
|
};
|
|
|
|
static const char grp_op_pos_p1[] =
|
|
{
|
|
RULE_OP_MANGLE_DUPEWORD_TIMES,
|
|
RULE_OP_MANGLE_DUPECHAR_FIRST,
|
|
RULE_OP_MANGLE_DUPECHAR_LAST,
|
|
RULE_OP_MANGLE_DUPEBLOCK_FIRST,
|
|
RULE_OP_MANGLE_DUPEBLOCK_LAST
|
|
};
|
|
|
|
static const char grp_op_chr[] =
|
|
{
|
|
RULE_OP_MANGLE_APPEND,
|
|
RULE_OP_MANGLE_PREPEND,
|
|
RULE_OP_MANGLE_PURGECHAR
|
|
};
|
|
|
|
static const char grp_op_chr_chr[] =
|
|
{
|
|
RULE_OP_MANGLE_REPLACE
|
|
};
|
|
|
|
static const char grp_op_pos_chr[] =
|
|
{
|
|
RULE_OP_MANGLE_INSERT,
|
|
RULE_OP_MANGLE_OVERSTRIKE
|
|
};
|
|
|
|
static const char grp_op_pos_pos0[] =
|
|
{
|
|
RULE_OP_MANGLE_SWITCH_AT
|
|
};
|
|
|
|
static const char grp_op_pos_pos1[] =
|
|
{
|
|
RULE_OP_MANGLE_EXTRACT,
|
|
RULE_OP_MANGLE_OMIT
|
|
};
|
|
|
|
static const char grp_op_pos1_pos2_pos3[] =
|
|
{
|
|
RULE_OP_MANGLE_EXTRACT_MEMORY
|
|
};
|
|
|
|
static const char grp_pos[] =
|
|
{
|
|
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B'
|
|
};
|