2

I am trying to generate a wordlist. I am using crunch but I am stuck at defining the pattern I want the words to be generated. For example, I want to define a rule such as this:

Password: Ameri948 ca#

Words: [A|a]meri[\d\d\d][space|no space][C|c]a[space|*|#]

Which means, I know the structure of the password and the exact length (here the space or no space plays a role), but not the exact combinations, e.g. the first character is for sure an A but I don't know whether it is a capital A or a lowercase one. And another problem is spaces, to get the password to a certain length, which I know, I tried some sort of padding with spaces in between words.

Can a pattern like this be defined in crunch? Or would you suggest just coding it?

schroeder
  • 123,438
  • 55
  • 284
  • 319

2 Answers2

1

You could use a tool like Generex to generate strings out of a regular expression. I think your case would be:

[Aa]meri\d{3}\s?[Cc]a\s{0,4}#

I limited the latter space to max 4 so the regex would be able to terminate. There are some online tools available that do this too.

ysf
  • 26
  • 1
0

You can use the sets from crunch. However, there are only 4:

@ , % ^

Depending on the number of spaces, you can write them down directly. For

[A|a]meri[\d\d\d][space|no space][C|c]a[space|*|#]

this could be:

crunch 12 12 aA cC + \ *# -t '@meri%%% ,a^' -o list && crunch 11 11 aA cC + \ *# -t '@meri%%%,a^' >> list

Here I used the 3rd default set (defined with +) what are numbers.

Or you could put a bash script around it, e.g. using https://stackoverflow.com/questions/43076395/how-to-add-x-number-of-leading-spaces-in- a-string-using-bash if you want to loop over some spaces:

for space_amount in {1..3}; do spaces=$(printf "%*s" $space_amount);crunch $(expr 11 + $space_amount) $(expr 11 + $space_amount) aA cC + \ *# -t "@meri%%%$spaces,a^" >> list; done

If you need more sets I would use Generex as recommended from ysf or start expanding it programmatically.

secf00tprint
  • 202
  • 1
  • 11