Crunch : wordlist generator

Raj Upadhyay
4 min readSep 2, 2020

Crunch is a tool that is used to create wordlists using numbers, letters, and symbols for every possible combination. It’s command Line tool.

Let’s open terminal and type “crunch”

Crunch

So we can see version of crunch is 3.6 and we can see syntax also

crunch <min> <max> [options]

Let’s first do man command for crunch

man crunch

man crunch

Man command give us useful information about CRUNCH.

Now let’s learn how to use crunch

Syntax : crunch [min] [max] options

min : minimum length.

max : maximum length.

options :

-b : maximum size of the wordlist
-c : numbers of lines to write to the wordlist
-d : limit the number of duplicate characters
-e : stop generating words at a certain string
-f : specify a list of character sets from the charset.lst file
-i : invert the order of characters in the wordlist
-l : allows the literal interpretation of @,%^ when using -t
-o : output wordlist file
-p : print permutations without repeating characters
-r : resume a previous session
-s : specify a particular string to begin the wordlist with
-t : set a specific pattern of @,%^
-z : compress the output wordlist file

@ represents lowercase letters [a-z]
, represents uppercase letters [A-Z]
% represents numbers [0–9]
^ represents special characters [@!#etc]

Let’s see first Example.

let’s create wordlist by using “asb” as input characters. we will create list that has minimum length of 1 character and maximum length is 3 character.

Syntax : crunch min max options

command : crunch 1 3 asb

Here 1 is minimum length, 3 is maximum length and “asb” is character strings from which crunch will generate all possible wordlist.

crunch first example.

As we can see it will generate total 39 words.

Now let’s create 3 character long wordlist with combination of “abcdefghijklmnopqrstuwxyz” and save all possible combination in output file atoz.txt.

Command : crunch 3 3 abcdefghijklmnopqrstuvwxyz -o atoz.txt

3 character long wordlist using a-z

Now consider case where we know length of password is 4. and we know last character of password is 1.we know 1st and 3rd character are in lowercase and 2nd in uppercase. we know uppercase used in password is from following string “PQRST” and lowercase is from “xyz”.

Syntax: crunch min max options

crunch 4 4 "xyz" "PQRST"  -t @,@1 -o password.txt

Here,

min length is set to 4 and max length is set to 4.

we have given string “xyz” for lowercase and “PQRST” for uppercase.

as we know 1st and 3rd character is in lowercase 2nd character is in upper case and we know password ends with 1. So we use -t to specify all this.

@ will denote lowercase

, will denote uppercase

we will store wordlist in password.txt via -o

Password Generator

Crunch provides “charset.lst” lets see that.

First let’s find out location of “charset.lst” file and let see first few lines of charset.lst file

charset.lst

Let’s see full “charset.lst” via cat command.

cat charset.lst
cat charset.lst

So let’s learn how to use this charset.lst

Let’s create 2 digits number wordlist via charset.lst

syntax : crunch min max -f charset.lst parameter -o output.txt

command : crunch 2 2 -f charset.lst numeric -o 2digits.txt
2 digit number wordlsit using charset.lst

This is how it’s useful to generate wordlist.

Thank you for reading.

--

--

Raj Upadhyay

Pursuing M. Tech. in Cyber Security and Incident Response. #LoveToPlayCTF #infosec #cybersecurity