-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Solve issue Update hashcat mode with new rules #5905 #5965
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: bleeding-jumbo
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1424,7 +1424,35 @@ char *rules_apply(char *word_in, char *rule, int split) | |
| break; | ||
|
|
||
| case 'v': /* assign value to numeric variable */ | ||
| if (hc_logic) | ||
| { | ||
| /* HC rule: insert char X every N chars */ | ||
| unsigned int n, i, out_len = 0; | ||
| char value; | ||
| char *out; | ||
| POSITION(n) | ||
| VALUE(value) | ||
| if (!n) | ||
| break; | ||
| GET_OUT | ||
| for (i = 0; i < length; i++) | ||
| { | ||
| if (out_len >= RULE_WORD_SIZE - 1) | ||
| break; | ||
| out[out_len++] = in[i]; | ||
| if (((i + 1) % n) == 0) { | ||
| if (out_len >= RULE_WORD_SIZE - 1) | ||
| break; | ||
| out[out_len++] = value; | ||
| } | ||
| } | ||
| out[out_len] = 0; | ||
| in = out; | ||
| length = out_len; | ||
| break; | ||
| } | ||
| else | ||
| { /*Original JtR rule */ | ||
| char var; | ||
| int a, s; /* may be negative */ | ||
| VALUE(var) | ||
|
|
@@ -1436,6 +1464,45 @@ char *rules_apply(char *word_in, char *rule, int split) | |
| rules_vars[ARCH_INDEX(var)] = a - s; /* may be negative */ | ||
| } | ||
| break; | ||
|
|
||
| case 'h': /*convert the entire password to lowercase hex */ | ||
| { | ||
| char outbuf[RULE_WORD_SIZE * 2]; | ||
| int i; | ||
| if (length * 2 >= RULE_WORD_SIZE) | ||
| break; | ||
| for (i = 0; i < length; i++) | ||
| sprintf(&outbuf[i * 2], "%02x", (unsigned char)in[i]); | ||
| strcpy(in, outbuf); | ||
| length *= 2; | ||
| } | ||
| break; | ||
|
|
||
| case 'H': /*convert the entire password to uppercase hex*/ | ||
| { | ||
| char outbuf[RULE_WORD_SIZE * 2]; | ||
| int i; | ||
| if (length * 2 >= RULE_WORD_SIZE) | ||
| break; | ||
| for (i = 0; i < length; i++) | ||
| sprintf(&outbuf[i * 2], "%02X", (unsigned char)in[i]); | ||
|
Comment on lines
+1485
to
+1488
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The first line here (and same for 'h') aborts without converting a single letter to hex. I'm not saying it's wrong (we don't have a spec that detailed) and I don't care - I think RULE_WORD_SIZE is pretty large. Just mentioning it.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I also don't think it's a problem, if it's acceptable now should it be merged?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe @solardiz wants to look at this first, I'm not sure. I'm not 100% sure of the cryptic rules.c macros such as GET_OUT, and I haven't had time to delve into it yet. It's unfortunate we have so very long delay in merging stuff right now. |
||
| strcpy(in, outbuf); | ||
| length *= 2; | ||
| } | ||
| break; | ||
|
|
||
| case 'B': /* add byte value of X at pos N, bytewise. Format: BNX */ | ||
| { | ||
| unsigned int pos; | ||
| unsigned char val; | ||
| POSITION(pos) | ||
| VALUE(val) | ||
| if (pos < length) | ||
| { | ||
| in[pos] = (unsigned char)(in[pos] + val); | ||
| } | ||
|
Serax4 marked this conversation as resolved.
Outdated
|
||
| } | ||
| break; | ||
|
|
||
| /* Additional "single crack" mode rules */ | ||
| case '1': | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.