[GH-ISSUE #762] Mask mode: custom masks #395

Closed
opened 2026-10-14 03:05:09 +07:00 by bsakaguchi · 8 comments
Owner

Originally created by @magnumripper on GitHub (Sep 26, 2014).
Original GitHub issue: https://github.com/openwall/john/issues/762

Originally assigned to: @magnumripper on GitHub.

Hashcat has this as -1 through -4 so maybe we should adopt that.

-1=?u?l -mask=?1?l?l?l would produce [A-Za-z][a-z][a-z][a-z]

We should support things like -1=[aouei?d] too. But that is a placeholder within a [] range... would that mean we'd support -mask=[?u?l]?l?l?l as equivalent to -1=?u?l -mask=?1?l?l?l?

Originally created by @magnumripper on GitHub (Sep 26, 2014). Original GitHub issue: https://github.com/openwall/john/issues/762 Originally assigned to: @magnumripper on GitHub. Hashcat has this as `-1` through `-4` so maybe we should adopt that. `-1=?u?l -mask=?1?l?l?l` would produce [A-Za-z][a-z][a-z][a-z] We should support things like `-1=[aouei?d]` too. But that is a placeholder within a [] range... would that mean we'd support `-mask=[?u?l]?l?l?l` as equivalent to `-1=?u?l -mask=?1?l?l?l`?
bsakaguchi 2026-10-14 03:05:09 +07:00
Author
Owner

@frank-dittrich commented on GitHub (Sep 26, 2014):

I'd prefer not to support -1=... etc, and --mask=?1 refer to the definition in the [UserClasses] section.

1 = [0-9a-fA-F]

But then, I'd love to use the "character classes" used for rules in mask mode, despite that being incompatible with hashcat (and InsidePro).
May be we need a john.conf option or even different "mask mode" sections [Mask.hashcat], [Mask.john], etc. and a default setting which can be changed in john-local.conf.

<!-- gh-comment-id:56991025 --> @frank-dittrich commented on GitHub (Sep 26, 2014): I'd prefer not to support -1=... etc, and --mask=?1 refer to the definition in the [UserClasses] section. ``` 1 = [0-9a-fA-F] ``` But then, I'd love to use the "character classes" used for rules in mask mode, despite that being incompatible with hashcat (and InsidePro). May be we need a john.conf option or even different "mask mode" sections [Mask.hashcat], [Mask.john], etc. and a default setting which can be changed in john-local.conf.
Author
Owner

@magnumripper commented on GitHub (Sep 26, 2014):

A john.conf-only alternative is out of the question. I would definitely hate having to edit a config file to try another mask. And even worse, if you have jobs running with a mask configured in john.conf and then edit the conf... chaos!

Having said that, we could definitely have defaults for -1 and so on, in john.conf, under a Mask section. They could come with the Hashcat defaults pre-filled in.

<!-- gh-comment-id:57002198 --> @magnumripper commented on GitHub (Sep 26, 2014): A john.conf-only alternative is out of the question. I would definitely hate having to edit a config file to try another mask. And even worse, if you have jobs running with a mask configured in john.conf and then edit the conf... chaos! Having said that, we could definitely have _defaults_ for `-1` and so on, in john.conf, under a Mask section. They could come with the Hashcat defaults pre-filled in.
Author
Owner

@magnumripper commented on GitHub (Sep 26, 2014):

@Sayantan2048 obviously things like this are not anything you should bother with, you should just concentrate on GPU generation please!

<!-- gh-comment-id:57002665 --> @magnumripper commented on GitHub (Sep 26, 2014): @Sayantan2048 obviously things like this are not anything you should bother with, you should just concentrate on GPU generation please!
Author
Owner

@magnumripper commented on GitHub (Sep 27, 2014):

Crude support added. You can't currently use placeholders or ranges within custom placeholders (we need to recurse) so this won't work yet: -1=?u?d (and nor will -1=[a-z], or -mask=[?l?d] or using \xHH) but this works fine: -1=0123456789abcdef -mask=de:ad:?1?1:?1?1:ba:be.

Also, john.conf defaults are added, with the same limitations.

<!-- gh-comment-id:57039066 --> @magnumripper commented on GitHub (Sep 27, 2014): Crude support added. You can't currently use placeholders or ranges within custom placeholders (we need to recurse) so this won't work yet: `-1=?u?d` (and nor will `-1=[a-z]`, or `-mask=[?l?d]` or using `\xHH`) but this works fine: `-1=0123456789abcdef -mask=de:ad:?1?1:?1?1:ba:be`. Also, john.conf defaults are added, with the same limitations.
Author
Owner

@magnumripper commented on GitHub (Sep 27, 2014):

Also to do: Add stuff to usage blob

<!-- gh-comment-id:57039177 --> @magnumripper commented on GitHub (Sep 27, 2014): Also to do: Add stuff to usage blob
Author
Owner

@magnumripper commented on GitHub (Sep 27, 2014):

See also #380 for -min/max-length support.

<!-- gh-comment-id:57039226 --> @magnumripper commented on GitHub (Sep 27, 2014): See also #380 for -min/max-length support.
Author
Owner

@magnumripper commented on GitHub (Sep 27, 2014):

I wonder if Hashcat allows things like -2=?1?d... it may come handy but we'd have to watch out for "loops". Perhaps we can allow -2..-4 to include ?1, and ?3 and ?4 could also include ?2 and so on.

<!-- gh-comment-id:57039322 --> @magnumripper commented on GitHub (Sep 27, 2014): I wonder if Hashcat allows things like `-2=?1?d`... it may come handy but we'd have to watch out for "loops". Perhaps we can allow -2..-4 to include ?1, and ?3 and ?4 could also include ?2 and so on.
Author
Owner

@magnumripper commented on GitHub (Oct 2, 2014):

This was fixed in #776.

<!-- gh-comment-id:57636408 --> @magnumripper commented on GitHub (Oct 2, 2014): This was fixed in #776.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
openwall/john#395
No description provided.