Kali Linux – Crunch Utility

In order to hack a password, we have to try a lot of passwords to get the right one. When an attacker uses thousands or millions of words or character combinations to crack a password there is no surety that any one of those millions of combinations will work or not. This collection of a different combination of characters is called a wordlist. And in order to crack a password or a hash, we need to have a good wordlist which could break the password. So to do so we have a tool in kali Linux called crunch

crunch is a wordlist generating tool that comes pre-installed with Kali Linux. It is used to generate custom keywords based on wordlists. It generates a wordlist with permutation and combination. We could use some specific patterns and symbols to generate a wordlist.

Installing crunch tool

To install crunch tool use the following commands as per your Linux distribution.

In case of Debian/Ubuntu

$sudo apt-get install crunch

In case of CentOS/RedHat



$sudo yum install crunch

In case of Fedora OS

$sudo dnf install crunch

Working with crunch tool

1. To check the installation.

crunch

kali Linux crunch

This command will display the initial page of crunch tool which verifies the tool installation.

2. To create a word list of specific numbers.

cruch 1 2 0123456789

crunch_numbers_wordlist

This command will generate a wordlist of 110 words having the one and 2 digit numbers with all combinations of digits 0, 1, 2, 3, 4, 5, 6, 7, 8, 9. you could use alphabets

3. To save the wordlist into a file



crunch 1 2 0123456789 >wordlist.txt

crunch_wordlist_to_file

This command will generate a wordlist of 110 words having the one and 2 digit numbers with all combinations of digits 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 and will copy the same to a text file named as wordlist.txt.

4. To save the wordlist to a file with -o option

crunch  1 2 0123456789 -o wordlist.txt

crunch-o-wordlist-file

This command will generate a wordlist of 110 words having the one and 2 digit numbers with all combinations of digits 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 and will copy the same to a text file named as wordlist.txt.

5. To generate a file usig rainbow charset file

crunch 2 3 -f /usr/share/rainbowcrack/charset.txt

crunch-rainbow

This command will use the charset present in the /usr/share/rainbowcrack/charset.txt file in order to generate a wordlist.

6. To generate a wordlist with a specific pattern.

crunch 10 10 -t manav^%%%% 

Here we have 4 characters to represent some group of characters which are as follows:

  • , for all uppercase letters
  • @ for all lowercase letters
  • % for all numeric characters
  • ^ for all special characters

crunch-pattern

So the above command will output all the words starting with “manav” and then after that a special character and then 4 digit number.

7. To generate a wordlist with a permutation of some strings or characters

crunch 1 10 -p Hello Manav

In the case of -p, the minimum size and the maximum size values are ignored by the crunch and it displays all the possible permutations.

crunch_permutation

The above command will give 2 permutations of “hello manav”.

My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.