Crunch: using -d 1, -d 1% options with first two chars DD
The Scenario
According to your requirements, the words in your wordlist should have :
- Two Uppercase D's ie.
DD
followed by - Two non-repeating Uppercase characters followd by
- Two non-repeating Numbers.
Going by the requirements first word should be DDAB01
. Now , consider these two points :
-
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 contains2 repeating literal uppercase D's
-
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 encountersDD
in the pattern itself, It makes the program to exit out generating0 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
OR
crunch 4 4 -d 1,% -t ,,%% | awk '{ print "DD"$1 }' > wordlist
Feel free to add-in more details.