To learn about Crunch follow the given steps:
- Crunch is preinstalled with Kali, and we can launch it with this command:
crunch -h
- As we see, it is easy to use to generate a password list of a minimum of two characters and maximum of two characters containing only abcdef, and we can use the following command:
crunch 2 2 abcdef
We can see that the word list has been generated:
- To save it in a file, we can use the -o switch. Crunch also has an inbuilt list containing a predefined character set. It can be found at /usr/share/crunch/charset.lst.
- To use a charset, we use the -f switch:
crunch 2 2 -f /usr/share/crunch/charset.lst lalpha
The following screenshot shows the output of the preceding command:
- This will generate a list of a minimum length and maximum length of 2, containing lowercase alphabets. Crunch also has a -t switch, which can be used to create a word list of a specific pattern:
- @: This will insert lowercase characters
- ,: This will insert uppercase characters
- %: This will insert numbers
- ^: This will insert symbols
- Switch -b can be used to specify the size of the file you want to create:
- Let's try to create a list with a specific pattern and of 1 MB in size:
crunch 10 10 -t @@packt,,% -b 1mib -o START
- Once it's, done, we will see a list of text files created with the pattern in the same folder:
- The -z flag can be used to create a word list and save it in a compressed file. The compression is done on the go:
crunch 10 10 -t @@packt,,% -b 1mib -o START -z gzip
The following screenshot shows the output of the preceding command: