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

Feature req [masks]: add increment backwards flag #3959

Open
ysrn opened this issue Feb 29, 2024 · 7 comments
Open

Feature req [masks]: add increment backwards flag #3959

ysrn opened this issue Feb 29, 2024 · 7 comments

Comments

@ysrn
Copy link

ysrn commented Feb 29, 2024

Currently when using the increment feature it goes from the start of the pattern to its end. I think it would be super useful to have a flag to reverse that direction. I'm hitting up against this use-case a lot, and thought it might be useful to others as well.

Example:
If I'd like to run through all masks starting with a single digit and ending with 2-4 lowercase, that's easy: -i ?d?l?l?l?l

Now, if I'd like to run through all masks ending with a single digit, but starting with 2-4 lowercase. I'm forced to verbosely specify each mask in order: -i ?l?l?d then -i ?l?l?l?d then -i ?l?l?l?l?d.

If I had --increment-backwards, then I could use a simple -i --increment-backwards ?l?l?l?l?d.

@Chick3nman
Copy link
Contributor

While this isn't a rebuttal you could work around this currently by specifying the masks in a mask file to avoid having to run multiple attacks. An "inverse increment" or similar flag could still prove useful.

@dmgarry
Copy link

dmgarry commented Feb 29, 2024

Just thinking about this... May or May not be possible as I can't try it at the minute but if you stdout... put your mask in reverse so last character first and so on... increment it the way you want... pipe it back into hashcat applying the reverse rule?

@Chick3nman
Copy link
Contributor

You could do that @dmgarry but you lose the speed/efficiency of running the mask attack from within the kernel. By using mask files you achieve the same thing but without the potential speed loss.

PenguinKeeper7 added a commit to PenguinKeeper7/hashcat that referenced this issue Feb 29, 2024
@PenguinKeeper7
Copy link
Contributor

PenguinKeeper7 commented Feb 29, 2024

Please test #3960 and see if it meets what you want. Here's an example command, using your listed situation of an unknown amount of letters, then one number at the end

> ./hashcat -m 99999 abcd1 -a 3 ?l?l?l?l?l?l?l?d -i --increment-inverse --quiet

abcd1:abcd1

@ysrn
Copy link
Author

ysrn commented Mar 1, 2024

Woah that was fast! I tested it and played around a bit. It does exactly what I described/needed and will be incredibly useful, thank you!

@ysrn
Copy link
Author

ysrn commented Mar 1, 2024

Found a small bug by looking at the code. Using an escaped question mark ?? in the pattern will lead to it being misinterpreted as a pattern token instead of a literal. So the pattern ?l??1?d will error twice with "Custom charset 1 is undefined" in inverse mode.

@PenguinKeeper7
Copy link
Contributor

Found a small bug by looking at the code. Using an escaped question mark ?? in the pattern will lead to it being misinterpreted as a pattern token instead of a literal. So the pattern ?l??1?d will error twice with "Custom charset 1 is undefined" in inverse mode.

Thanks for the report! I've fixed this issue with cbc3470 and a mask file bug with custom charsets.
There are no known issues so please let me know if you do find another

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

No branches or pull requests

4 participants