Spread the love

What is Crunch?

Crunch is a great linux tool used for generating passwords. You can tell him what combination you need and it will generate it. If you need all the password combinations containing 6 digits and for example “abcde1234!” it will generate a file with all of them. The output from crunch can be sent to the screen, file, or to another program.

The syntax is really simple:

./crunch <from-len> <to-len> [-f <path to charset.lst> charset-name] [-o wordlist.txt or START]

options:
-f /path/to/charset.lst charset-name
              Specifies a character set from the charset.lst
-o wordlist.txt
              Specifies the file to write the output to, eg: wordlist.txt

./crunch 8 8 -f charset.lst mixalpha-numeric-all-space -o wordlist.txt
       crunch  should generate a 8 character wordlist using the mixalpha-number-all-space character set from charset.lst and will write the wordlist to a file named wordlist.txt.  The file will start at cbdogaaa and end at "  dog "

For compleate manual please visit crunch man page.
Code language: Bash (bash)

Installation in Ubuntu linux

sudo apt install crunch

Installation in Debian linux

sudo apt-get install crunchCode language: JavaScript (javascript)

Example 1 generating a 6 digit file containing “abcde1234!”

crunch 6 6 'abcde1234!' -o exportfile.txt
Code language: JavaScript (javascript)
crunch 6 6 'abcde1234!' -o exportfile.txt

Example 2 generating a 8 digit file containing special characters

crunch 8 8 pentest\@\#\$\%\^\&\! -o textnum.txtCode language: PHP (php)
crunch 8 8 pentest\@\#\$\%\^\&\! -o textnum.txt

Here is a simple video using crunch

Conclusion

Crunch is used from penetration testing teams to generate random passwords to test wireless systems, firewalls and other IoT systems, it simple, easy to use and it’s fast.

If you are interested you can check How to generate a random password in linux using /dev/random

Leave a Reply