I'm trying to generate a list of words where the minimum length is 6 and the max length is 6, where the first pair of characters are fixed and consecutive, the second two characters are upper alpha characters with no consecutive repeats, and the last pair of characters are numbers with no consecutive repeats. Here is the pattern I'm trying to achieve:


Here is what I tried, using the -d option:

crunch 6 6 -d 1, -d 1% -t DD,,%% -o list.txt

But it doesn't even generate a single line. To reiterate, the only consecutive repeats are the initial two characters (D|D), while the next two upper-case characters should not repeat, nor should the final two number characters repeat. Can this pattern be achieved with crunch?

I'm using crunch version 3.6.

  • 1
    According to your requirements, DDAB01 should be the first word in the list generated by crunch. Commented May 12, 2018 at 8:03
  • 1
    You could just use -d 1,% instead of -d 1, -d 1%. Commented May 12, 2018 at 9:06

1 Answer 1


The Scenario

According to your requirements, the words in your wordlist should have :

  1. Two Uppercase D's ie. DD followed by
  2. Two non-repeating Uppercase characters followd by
  3. Two non-repeating Numbers.

Going by the requirements first word should be DDAB01. Now , consider these two points :

  1. man crunch and look for -t option

    -t @,%^
          Specifies  a pattern, eg: @@god@@@@ where the only the @'s, ,'s,
          %'s, and ^'s will change.
          @ will insert lower case characters
          , will insert upper case characters
          % will insert numbers
          ^ will insert symbols

    So, any pattern specified by -t option is treated as a literal character except for the characters @ , , , % and ^ that are replaced with characters as defined by crunch.

    In your case pattern is DD,,%% that contains 2 repeating literal uppercase D's

  2. Now, man crunch and look for -d option

    -d numbersymbol
          Limits the number of duplicate characters.   -d  2@  limits  the
          lower  case  alphabet to output like aab and aac.  aaa would not
          be generated as that is 3 consecutive letters of a.  The  format
          is  number  then  symbol  where  number is the maximum number of
          consecutive characters and symbol  is  the  symbol  of  the  the
          character set you want to limit i.e. @,%^

You have written in your command, -d 1, that means No repetition of uppercase characters and -d 1% meaning No repetition of Numbers.

The Problem

  • -d 1,

    You have specified to -d option that, there should be only one instance of characters and numbers ignoring any repetitions.

  • -t DD,,%%

    But you have passed a pattern that itself contains repetition of letter D. As soon as -d option encounters DD in the pattern itself, It makes the program to exit out generating 0 lines. Hope you understand now, what you were doing wrong.

The Solution / Workaround

Create 4-length wordlist and pipe it to sed or awk to append DD at beginning and finally redirect to wordlist file.

crunch 4 4 -d 1,% -t ,,%% | sed 's/^/DD/' > wordlist


crunch 4 4 -d 1,% -t ,,%% | awk '{ print "DD"$1 }' > wordlist

Feel free to add-in more details.

  • 1
    Nice answer, probably the most important thing in your answer was the man page. Kudos Commented May 30, 2018 at 12:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .