Hashcat claims to be the world's fastest password cracking tool.

2024-12-24 20:36:31

Hashcat claims to be the fastest code-breaking tool in the world, and today's article will extract a few common and commonly used parameters, combined with password-breaking commands, to analyze how to use hashcat to decipher passwords.

1.png

-m /--hash-type

We know that hashcat can decipher a large number of password types, it can decipher about 210 types of ciphers, the vast majority of which are hashes. If you want to decipher a password with hashcat, you first need to understand the form of the password, and then index the number of the password in the hashcat according to the password form.

Let's take the password: digapis and salt asdf as examples to show the form of some hash values.

numberingnametypeexample
0MD5Hash, length 328713d75511bea7e0df78c6063dc778b0
1400SHA-256hashaa106625c7de812d6118992a191ea4627e2457fa80bf6ec06f9c60cbf8e5260f
1700SHA-512hash23afac4524f62ea4d941ca4933249b2b78d19069773266abc36d6fd17a6fbe2f4ccc834acc868358ba32ddca553611218a2865f975339fe45d38cc1999f84b5e
10Md5($pass.$salt)MD5 is performed once after the password is salted, with the password first48985c61e2581c3f9ee5f1cfb775afbc:asdf
20MD5($salt.$pass)Salt first4fa1dd606353e055fed67d9812bddf35:asdf
2600md5(md5($pass))The password is MD5 2 times98177c3f36af4a3f77f5b87594e6cf6a
3710md5($salt.md5($pass))The password is MD5 transformed, preceded by salt, and MD5 is performed again88a535877ec21b8786775a7074e4de4c:asdf
4400md5(sha1($pass))The password is changed once sha1 and then MD5ec7bf3099984001a2b0f37ba5d1d68fa
4500sha1(sha1($pass))outline005a41cfe16c9a5556c7a5cdd5f1958991f2e031
1460HMAC-SHA256(key=$salt)outlined684ab7c38ddc262f215328334c4d0273cef10d6c5e61988f5cc87fcab8a7a60:asdf
11500CRC32outline4C244A19:00000000

-a/--attack-mode

The -a command can specify the attack mode. To use hashcat to decipher the password, it is not enough to know the password number, but also to select the attack mode of using hashcat to decipher the password.

Hashcat 4.0.1 has 5 attack patterns, each with its own characteristics.


numberingAttack patternsmeaning
0straightDirect attack mode
1CombinstionCombo attack mode
3Brute-forceExplosive crack mode
6Hybrid Wordlist+MaskDictionary + mask combination
7Hybird Mask+WordlistMask + dictionary combination

In these 5 attack modes, we can use dictionaries to decipher, use brute force to traverse all possible passwords, or combine dictionaries and masks for code breaking. In different attack modes, the parameters used in the hashcat command are different, let's take the straight attack mode as an example to learn how hashcat uses dictionary files to decipher passwords. Colleagues will also intersperse the use of other parameters.

Direct Attack Mode (-a 0)

The direct attack mode is to directly use the dictionary to perform password blasting, which can use a single dictionary file or multiple dictionary files for decryption. You can also combine dictionaries with rule files to make password blasting more efficient.

Single Dictionary Attack:

hashcat -a 0 –m 0 mima.txt –o outfile dic.txt

4.png

-a specifies the attack mode as direct attack, -m specifies the hash type as MD5, and -o writes the deciphered password to the outfile.

Double dictionary attack

A double dictionary attack is also a case of direct attack mode, in which two dictionary files are loaded when the password is blasted using the dictionary file. This expands the space of the dictionary file.

5.png

Multi-dictionary attacks

The following command uses three dictionaries to perform a dictionary attack, and loads three dictionaries in turn to blast. The dic.txt in the command is the dictionary file used in the blast.

6.png

Dictionary directory attacks

The dictionary directory attack will use multiple dictionary files in the dictionary directory for direct attack, and the dictionary directory will load multiple dictionary files in the dictionary directory in sequence during the direct attack, and the dic in the following command is the folder where the multiple dictionary files are located.

7.png

Dictionary + rule attack

The -r/--rule-file command applies multiple rules in the rules file to each word in the dictionary. The rule file can be generated by yourself or by using the rule file that comes with hashcat. The rules file that comes with hashcat is usually located in the rules folder. The rules file in the rules folder is as follows:

8.png

In a dictionary + rule attack, a single dictionary, multiple dictionaries, or dictionary directories can be combined with rule files to perform password blasting. In fact, it is in the form of a direct attack and a combination of rules and documents.

Rules are similar to programming languages that generate candidate passwords, which can modify, cut, expand words, or skip actions based on conditional operators. In this way, attacks can be carried out more flexibly and efficiently.

9.pngRule attacks can be used in combination with dual dictionaries, multiple dictionaries, or even dictionary directories. The usage method is similar to that of a single dictionary + rule attack.

Output commands

-o/--outfile

The -o parameter is followed by the outgoing file, and the deciphered password is entered into the specified file through the -o command, and the default storage form is hash:plain. There is an example of how this command is used, so let's take a look at the above picture for yourself.

--outfile-format

This command can specify the output format of the outfile file. There are 15 output modes in the Outfile file.

10.png

Outfile-format=1 only outputs the deciphered ciphertext hash;

11.png12.png

Outfile-format=2, which outputs only the plaintext of the deciphered password.

13.png14.png

--remove

In addition to using the -o parameter to output, we can also use the parameter remove to filter out the deciphered passwords in the ciphertext file, leaving only the undecipherable passwords. This reduces duplication of effort when code breaking is carried out later.Q.png

15.png16.png

--status

When the number of password decipherment is large or the dictionary file is very large, the following options will appear, and the keyboard input S will print the next status on the screen, through which you can check the progress of the current password decipherment.

17.png

It will be troublesome to enter S every time you want to check the current password breaking progress, so you can use the status parameter to let the screen automatically update the status screen. Reducing the number of operations you need to do can also reduce false touches.

w.png

18.png

--status-timer

In addition to using the status parameter to automatically update the screen status, you can also use the --status-timer parameter to set the interval at which the status screen is updated.

19.png

summary

That's pretty much how to use the direct attack mode in Hashcat. If you are interested in hashcat, you can also visit the hashcat website, which has a detailed description of hashcat's command parameters and each attack mode.

Previous:Experience sharing of hashcat using GPU acceleration to improve d
Next:How to Improve the Success Rate of Password Cracking Technology