Beginners guide to crunch tool
In Previous articles we have used a word Bruteforce attack that is carried out with the help of a dictionary or we can say a list of common user names and passwords.
You can find list of usernames and passwords in /usr/share/wordlists directory but have you ever wondered can we create our own list? Yes in this article we are going to create our own list of username and password using a tool “crunch”
Table of Contents :
Introduction
Syntax of crunch
Using default character set
Set our own character set
Generate alpha numeric list
Generate list having space(““)
List with specified patterns
Using Permutation
Applying limit to generate small list
generate compressed wordlist
Introduction
As of now I haven’t encountered any CTF challenge where the dictionary that are present in kali Linux OS doesn’t work.But there can be a situation where we need a custom dictionary to find the correct login password For Ex. After doing a lot of Social Engineering we find out that a person’s social account can be something like this : hello,social,country,wifi,kite(may be the person loves kite) or it can be the person’s favourite food etc...So here we need to create our own list. That’s the reason we should know crunch.
Syntax of crunch
To check the syntax of crunch we issue the command:
crunch -h

In the above image we can see the syntax.Now in the next step we will use this syntax to generate a wordlist
Using default character set
Execute the command "crunch 2 3 -o /root/Desktop/haclabs"to generate a wordlist with default character set.
here 2 is the min. length and 3 is the max. length and -o specify the location to save the wordlist.

Now we will use cat command to display the content of the file . As the file is too large in no. of lines that's why we have used head -n 20 ,it will display first 20 lines of the file

Set our own character set
Now execute given below command which will generate a dictionary that contains minimum 3 character letters and maximum 5 by using “hac” as the specified string.
crunch 3 5 hac -o /root/Desktop/haclabs1

Now with the help of cat command we can see the content of the file "haclabs1"
"tail" is used to display the last 10 lines of the file

Similarly here we have used head to display first 20 lines of the file

Generate alpha numeric list
You can generate your own alpha-numeric wordlist, execute given below command which will generate a dictionary that contains minimum 3 character letters and maximum 5 by using “hac01” as the specified string.
crunch 3 5 hac01 -o /root/Desktop/haclabs2

Again we had used the cat to display the content of the file "haclabs2"


Generate list having space("")
The following command will generate wordlist using escape sequence character (\) with string “yash”. Instead of using (\) you can also use double quotes around string as “yash ” along with space within double quotes.
crunch 1 3 yash\ -o /root/Desktop/haclabs3

using cat to display the content of the file "haclabs3"
