Skip to content
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

Add support for rule position 'p' #1245

Merged
merged 1 commit into from May 17, 2017
Merged

Conversation

mhasbini
Copy link
Contributor

@mhasbini mhasbini commented May 12, 2017

The loop condition in RULE_OP_REJECT_CONTAINS was changed to be compatible with JtR.

echo 'remember' | ./hashcat --stdout -j '/e op3'
r3member

echo 'remember' |  ./hashcat --stdout -j '%2m ip!'
reme!mber

echo 'remember' |  ./hashcat --stdout -j '%3e op3 %2e op3 /e op3'
r3m3mb3r

Using p without using / or % before it, would result in an invalid rule.
E.g. echo 'remember' | ./hashcat --stdout -j 'op3' will return empty response with exit status 1.

This may not close #1035. I thought it's nice to have.

@jsteube
Copy link
Member

jsteube commented May 14, 2017

Thanks for your contributions. Please see my comments below:

  1. In the changes.txt:
+- Rules: Support added for position 'p'

This should be modified to reflect this change will work only for the CPU rule enging by using -j and -k, but not on GPU

  1. The macro name convention:
 #define RULE_OP_REJECT_EQUAL_AT         '=' // reject plains that do not contain char X at position N
 #define RULE_OP_REJECT_CONTAINS         '%' // reject plains that contain char X less than N times
 #define RULE_OP_REJECT_MEMORY           'Q' // reject plains that match the plain saved (see M), i.e. if unchanged
-
+#define RULE_REJECT_SAVED_POS           'p' // position of the character last found with '/' or '%'

I'm wondering if the "REJECT" substring is correct, or is it really working only for reject cases?

@mhasbini
Copy link
Contributor Author

@jsteube Thanks for checking!

  1. In the changes.txt:

I'll update the changelog entry to be:

  • Rules: Support added for position 'p' in host mode (using -j or -k)

What do you think?

  1. The macro name convention

I wasn't sure about the name.
p will only work if it's preceded by / or %, and will have the position of the last matched character as value.

Maybe RULE_LAST_REJECTED_SAVED_POS or RULE_CONTAINS_SAVED_POS?

@jsteube
Copy link
Member

jsteube commented May 14, 2017

  1. OK
  2. OK. RULE_LAST_REJECTED_SAVED_POS sounds good to me.

@jsteube jsteube merged commit 974128b into hashcat:master May 17, 2017
@roycewilliams
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

New rule: replace Nth character
3 participants