John the Ripper cracking with masking

We can use masking to target specific patterns without a wordlist. Masks follow a simple syntax where each character pattern type is defined with either a range or a placeholder with a question mark. For example, an uppercase (ASCII) letter would be defined with ?u, which would then be placed in the desired character position. Let's look at some examples:

Pattern

Mask

Six-character password with no symbols; an uppercase initial letter; last character is a digit

--mask=?u[A-Za-z0-9][A-Za-z0-9][A-Za-z0-9][A-Za-z0-9]?d

10-character password, all printable ASCII characters possible; first two letters are either A, B, or C of any case; last three characters are digits

--mask=[A-Ca-c][A-Ca-c]?a?a?a?a?a?d?d?d ...

Get Hands-On Penetration Testing on Windows now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.