mirror of
https://github.com/hashcat/hashcat.git
synced 2025-07-04 13:52:40 +00:00
Testing code, new rule #
This commit is contained in:
parent
9c206b7c42
commit
1fe55066e0
@ -298,6 +298,28 @@ DECLSPEC int mangle_toggle_at_sep (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const
|
||||
return (len);
|
||||
}
|
||||
|
||||
DECLSPEC int mangle_num_incr (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, PRIVATE_AS u8 *buf, const int len)
|
||||
{
|
||||
for (int pos = 0; pos < len; pos++)
|
||||
{
|
||||
const u8 byte = buf[pos];
|
||||
|
||||
if ((byte <= '9') && (byte >= '0'))
|
||||
{
|
||||
if (byte == '9')
|
||||
{
|
||||
buf[pos] = '0';
|
||||
}
|
||||
else
|
||||
{
|
||||
buf[pos]++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return (len);
|
||||
}
|
||||
|
||||
DECLSPEC int mangle_reverse (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, PRIVATE_AS u32 *buf, const int len)
|
||||
{
|
||||
for (int l = 0; l < len / 2; l++)
|
||||
@ -789,6 +811,7 @@ DECLSPEC int apply_rule (const u32 name, MAYBE_UNUSED const u8 p0, MAYBE_UNUSED
|
||||
case RULE_OP_MANGLE_DUPEBLOCK_LAST: out_len = mangle_dupeblock_last (p0, p1, (PRIVATE_AS u8 *) buf, out_len); break;
|
||||
case RULE_OP_MANGLE_TITLE_SEP: out_len = mangle_title_sep (p0, p1, buf, out_len); break;
|
||||
case RULE_OP_MANGLE_TITLE: out_len = mangle_title_sep (' ', p1, buf, out_len); break;
|
||||
case RULE_OP_MANGLE_NUM_INCR: out_len = mangle_num_incr (p0, p1, (PRIVATE_AS u8 *) buf, out_len); break;
|
||||
}
|
||||
|
||||
return out_len;
|
||||
|
@ -68,6 +68,7 @@
|
||||
#define RULE_OP_MANGLE_DUPEBLOCK_FIRST 'y'
|
||||
#define RULE_OP_MANGLE_DUPEBLOCK_LAST 'Y'
|
||||
#define RULE_OP_MANGLE_TITLE 'E'
|
||||
#define RULE_OP_MANGLE_NUM_INCR '#'
|
||||
|
||||
#define RP_PASSWORD_SIZE 256
|
||||
|
||||
@ -118,6 +119,7 @@ DECLSPEC int mangle_replace_nm1 (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8
|
||||
DECLSPEC int mangle_dupeblock_first (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, PRIVATE_AS u8 *buf, const int len);
|
||||
DECLSPEC int mangle_dupeblock_last (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, PRIVATE_AS u8 *buf, const int len);
|
||||
DECLSPEC int mangle_title_sep (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, PRIVATE_AS u32 *buf, const int len);
|
||||
DECLSPEC int mangle_num_incr (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, PRIVATE_AS u8 *buf, const int len);
|
||||
DECLSPEC int apply_rule (const u32 name, MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, PRIVATE_AS u32 *buf, const int in_len);
|
||||
DECLSPEC int apply_rules (CONSTANT_AS const u32 *cmds, PRIVATE_AS u32 *buf, const int in_len);
|
||||
|
||||
|
@ -1239,6 +1239,50 @@ DECLSPEC HC_INLINE_RP u32 rule_op_mangle_toggle_at_sep (MAYBE_UNUSED const u32 p
|
||||
return in_len;
|
||||
}
|
||||
|
||||
DECLSPEC HC_INLINE_RP u32 rule_op_mangle_num_incr (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED PRIVATE_AS u32 *buf0, MAYBE_UNUSED PRIVATE_AS u32 *buf1, const u32 in_len)
|
||||
{
|
||||
u32 t[8];
|
||||
|
||||
t[0] = buf0[0];
|
||||
t[1] = buf0[1];
|
||||
t[2] = buf0[2];
|
||||
t[3] = buf0[3];
|
||||
t[4] = buf1[0];
|
||||
t[5] = buf1[1];
|
||||
t[6] = buf1[2];
|
||||
t[7] = buf1[3];
|
||||
|
||||
PRIVATE_AS u8 *ptr = (PRIVATE_AS u8 *) t;
|
||||
|
||||
for (int pos = 0; pos < 32; pos++)
|
||||
{
|
||||
const u8 byte = ptr[pos];
|
||||
|
||||
if ((byte <= '9') && (byte >= '0'))
|
||||
{
|
||||
if (byte == '9')
|
||||
{
|
||||
ptr[pos] = '0';
|
||||
}
|
||||
else
|
||||
{
|
||||
ptr[pos]++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
buf0[0] = t[0];
|
||||
buf0[1] = t[1];
|
||||
buf0[2] = t[2];
|
||||
buf0[3] = t[3];
|
||||
buf1[0] = t[4];
|
||||
buf1[1] = t[5];
|
||||
buf1[2] = t[6];
|
||||
buf1[3] = t[7];
|
||||
|
||||
return in_len;
|
||||
}
|
||||
|
||||
DECLSPEC HC_INLINE_RP u32 rule_op_mangle_reverse (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED PRIVATE_AS u32 *buf0, MAYBE_UNUSED PRIVATE_AS u32 *buf1, const u32 in_len)
|
||||
{
|
||||
reverse_block_optimized (buf0, buf1, buf0, buf1, in_len);
|
||||
@ -2397,6 +2441,8 @@ DECLSPEC u32 apply_rule_optimized (const u32 name, const u32 p0, const u32 p1, P
|
||||
case RULE_OP_MANGLE_DUPEBLOCK_LAST: out_len = rule_op_mangle_dupeblock_last (p0, p1, buf0, buf1, out_len); break;
|
||||
case RULE_OP_MANGLE_TITLE_SEP: out_len = rule_op_mangle_title_sep (p0, p1, buf0, buf1, out_len); break;
|
||||
case RULE_OP_MANGLE_TITLE: out_len = rule_op_mangle_title_sep (' ', p1, buf0, buf1, out_len); break;
|
||||
case RULE_OP_MANGLE_NUM_INCR: out_len = rule_op_mangle_num_incr (p0, p1, buf0, buf1, out_len); break;
|
||||
|
||||
}
|
||||
|
||||
return out_len;
|
||||
|
@ -74,6 +74,7 @@
|
||||
#define RULE_OP_MANGLE_DUPEBLOCK_FIRST 'y'
|
||||
#define RULE_OP_MANGLE_DUPEBLOCK_LAST 'Y'
|
||||
#define RULE_OP_MANGLE_TITLE 'E'
|
||||
#define RULE_OP_MANGLE_NUM_INCR '#'
|
||||
|
||||
DECLSPEC u32 generate_cmask_optimized (const u32 value);
|
||||
DECLSPEC void truncate_right_optimized (PRIVATE_AS u32 *buf0, PRIVATE_AS u32 *buf1, const u32 offset);
|
||||
@ -127,6 +128,7 @@ DECLSPEC HC_INLINE_RP u32 rule_op_mangle_replace_np1 (MAYBE_UNUSED const u32 p0,
|
||||
DECLSPEC HC_INLINE_RP u32 rule_op_mangle_replace_nm1 (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED PRIVATE_AS u32 *buf0, MAYBE_UNUSED PRIVATE_AS u32 *buf1, const u32 in_len);
|
||||
DECLSPEC HC_INLINE_RP u32 rule_op_mangle_dupeblock_first (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED PRIVATE_AS u32 *buf0, MAYBE_UNUSED PRIVATE_AS u32 *buf1, const u32 in_len);
|
||||
DECLSPEC HC_INLINE_RP u32 rule_op_mangle_dupeblock_last (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED PRIVATE_AS u32 *buf0, MAYBE_UNUSED PRIVATE_AS u32 *buf1, const u32 in_len);
|
||||
DECLSPEC HC_INLINE_RP u32 rule_op_mangle_num_incr (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED PRIVATE_AS u32 *buf0, MAYBE_UNUSED PRIVATE_AS u32 *buf1, const u32 in_len);
|
||||
DECLSPEC u32 toggle_on_register (const u32 in, const u32 r);
|
||||
DECLSPEC HC_INLINE_RP u32 rule_op_mangle_title_sep (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED PRIVATE_AS u32 *buf0, MAYBE_UNUSED PRIVATE_AS u32 *buf1, const u32 in_len);
|
||||
DECLSPEC u32 apply_rule_optimized (const u32 name, const u32 p0, const u32 p1, PRIVATE_AS u32 *buf0, PRIVATE_AS u32 *buf1, const u32 in_len);
|
||||
|
Loading…
Reference in New Issue
Block a user