2015-12-04 14:47:52 +00:00
|
|
|
/**
|
2016-09-11 20:20:15 +00:00
|
|
|
* Author......: See docs/credits.txt
|
2015-12-04 14:47:52 +00:00
|
|
|
* License.....: MIT
|
|
|
|
*/
|
|
|
|
|
2016-09-06 16:44:05 +00:00
|
|
|
#ifndef _RP_CPU_H
|
|
|
|
#define _RP_CPU_H
|
2016-09-05 19:47:26 +00:00
|
|
|
|
2016-09-06 13:28:56 +00:00
|
|
|
#include <string.h>
|
|
|
|
|
2015-12-04 14:47:52 +00:00
|
|
|
#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'
|
|
|
|
|
2016-09-11 08:28:59 +00:00
|
|
|
#define INCR_RULES 10000
|
|
|
|
|
2016-09-06 13:28:56 +00:00
|
|
|
int generate_random_rule (char rule_buf[RP_RULE_BUFSIZ], u32 rp_gen_func_min, u32 rp_gen_func_max);
|
|
|
|
|
|
|
|
int _old_apply_rule (char *rule, int rule_len, char in[BLOCK_SIZE], int in_len, char out[BLOCK_SIZE]);
|
2016-09-06 16:44:05 +00:00
|
|
|
|
2016-09-08 12:22:10 +00:00
|
|
|
int cpu_rule_to_kernel_rule (char *rule_buf, uint rule_len, kernel_rule_t *rule);
|
|
|
|
int kernel_rule_to_cpu_rule (char *rule_buf, kernel_rule_t *rule);
|
|
|
|
|
2016-09-08 14:32:24 +00:00
|
|
|
int run_rule_engine (const int rule_len, const char *rule_buf);
|
|
|
|
|
2016-09-06 16:44:05 +00:00
|
|
|
#endif // _RP_CPU_H
|