hashcat 密碼破解工具 使用教程


日期:2019-08-16 15:03:12
更新:
做者:Bay0net
介紹:記錄一下 hashcat 的使用命令php


0x0一、Install

Hashcat Wiki - FAQpython

Github - World's fastest and most advanced password recovery utilitymysql

Install On Mac:brew install hashcatlinux

Features:git

  • World's fastest password cracker
  • World's first and only in-kernel rule engine
  • Free
  • Open-Source (MIT License)

0x0二、Usage

經常使用參數

-a              指定要使用的破解模式,其值參考後面對參數。「-a 0」字典攻擊,「-a 1」 組合攻擊;「-a 3」掩碼攻擊。
-m              指定要破解的hash類型,若是不指定類型,則默認是MD5
-o              指定破解成功後的hash及所對應的明文密碼的存放位置,能夠用它把破解成功的hash寫到指定的文件中
--force         忽略破解過程當中的警告信息,跑單條hash可能須要加上此選項
--show          顯示已經破解的hash及該hash所對應的明文
--username      忽略hash文件中的指定的用戶名,在破解linux系統用戶密碼hash可能會用到
--remove        刪除已被破解成功的hash
--increment     啓用增量破解模式,你能夠利用此模式讓hashcat在指定的密碼長度範圍內執行破解過程
--increment-min  密碼最小長度,後面直接等於一個整數便可,配置increment模式一塊兒使用
--increment-max  密碼最大長度,同上
--outfile-format 指定破解結果的輸出格式id,默認是3

-r       使用自定義破解規則

掩碼設置

l | abcdefghijklmnopqrstuvwxyz          純小寫字母
u | ABCDEFGHIJKLMNOPQRSTUVWXYZ          純大寫字母
d | 0123456789                  純數字
h | 0123456789abcdef                常見小寫子目錄和數字
H | 0123456789ABCDEF                常見大寫字母和數字
s |  !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~       特殊字符
a | ?l?u?d?s                    鍵盤上全部可見的字符
b | 0x00 - 0xff                 多是用來匹配像空格這種密碼的

掩碼實例

八位數字密碼:?d?d?d?d?d?d?d?d
八位未知密碼:?a?a?a?a?a?a?a?a
前四位爲大寫字母,後面四位爲數字:?u?u?u?u?d?d?d?d
前四位爲數字或者是小寫字母,後四位爲大寫字母或者數字:?h?h?h?h?H?H?H?H
前三個字符未知,中間爲admin,後三位未知:?a?a?aadmin?a?a?a
6-8位數字密碼:--increment --increment-min 6 --increment-max 8 ?l?l?l?l?l?l?l?l
6-8位數字+小寫字母密碼:--increment --increment-min 6 --increment-max 8 ?h?h?h?h?h?h?h?h

0x0三、Example

# 爆破 8 位數字的 MD5(2 秒)
hashcat -a 3 -m 0 --force ed2b1f468c5f915f3f1cf75d7068baae "?d?d?d?d?d?d?d?d"

# 爆破 1-8 位數字的 MD5
hashcat -a 3 -m 0 --force 4488cec2aea535179e085367d8a17d75 --increment --increment-min 1 --increment-max 8 "?d?d?d?d?d?d?d?d"

# 爆破 8 位小寫字母的 MD5(11分鐘)
hashcat -a 3 -m 0 --force 80d41e1777e11df88fa2a02508112a6c "?l?l?l?l?l?l?l?l"

# 利用字典爆破
hashcat -a 0 ede900ac1424436b55dc3c9f20cb97a8 password.txt -o result.txt

# 批量爆破 hash.txt
hashcat -a 0 hash.txt password.txt -o result.txt

# 字典 + 字典組合
hashcat -a 1 25f9e794323b453885f5181f1b624d0b pwd1.txt pwd2.txt

# 字典 + 掩碼組合
hashcat -a 6 9dc9d5ed5031367d42543763423c24ee password.txt "?l?l?l?l?l"

# 爆破 mysql 密碼(6 秒)
select host,user,authentication_string from mysql.user;
hashcat -a 0 -m 300 --force 81F5E21E35407D884A6CD4A731AEBFB6AF209E1B ~/pwd

# 爆破 mssql 密碼
hashcat -a 3 -m 132 --force 0x01008c8006c224f71f6bf0036f78d863c3c4ff53f8c3c48edafb "?l?l?l?l?l?d?d?d"

# 爆破 unix 密碼(MAC 下須要把 $ 加上反斜槓)
hashcat -a 0 -m 1800 --force "\$6\$u8S/M3kJ.aDI3y.q\$T6ACJn30kC48eGBUJMtF3JIp.Th0lKNAQz8s//T6q/kTqJsdHBuK1TStSaS2pRMKcYJ5CqqNfSbKCt68vghO6." ~/pwd

# 爆破 Windows 密碼
NT-hash:
hashcat -a 3 -m 1000 209C6174DA490CAEB422F3FA5A7AE634 "?l?l?l?l?l"
LM-hash:
hashcat -a 3 -m 3000 --force F0D412BD764FFE81AAD3B435B51404EE "?l?l?l?l?l"

# 爆破 wordpress 密碼 
# 具體加密腳本在./wp-includes/class-phpass.php的HashPassword函數
hashcat -a 3 -m 400 --force "\$P\$BYEYcHEj3vDhV1lwGBv6rpxurKOEWY/" "?d?d?d?d?d?d"

# 爆破 discuz 密碼(md5(md5($pass).$salt))
hashcat -a 3 -m 2611 --force 14e1b600b1fd579f47433b88e8d85291: "?d?d?d?d?d?d"

# Kali 查看全部的 *2john
ls /sbin/*john

# 爆破 rar 密碼(注意模式是 rar5 仍是 RAR3-hp)
rar2john 1.rar
hashcat -a 3 -m 13000 --force "\$rar5\$16\$639e9ce8344c680da12e8bdd4346a6a3\$15\$a2b056a21a9836d8d48c2844d171b73d\$8\$04a52d2224ad082e" "?d?d?d?d?d?d"

# 爆破 zip 密碼
zip2john.exe 1.zip
hashcat -a 3 -m 13600 "\$zip2\$*0*3*0*554bb43ff71cb0cac76326f292119dfd*ff23*5*24b28885ee*d4fe362bb1e91319ab53*\$/zip2\$" --force "?d?d?d?d?d?d"

# 爆破 office 密碼
python /usr/share/john/office2john.py 11.docx
hashcat -a 3 -m 9600 "\$office\$*2013*100000*256*16*e4a3eb62e8d3576f861f9eded75e0525*9eeb35f0849a7800d48113440b4bbb9c*577f8d8b2e1c5f60fed76e62327b38d28f25230f6c7dfd66588d9ca8097aabb9" --force "?d?d?d?d?d?d"

# 破解 WiFi 密碼
# 首先先把咱們的握手包轉化爲 hccapx 格式,如今最新版的 hashcat 只支持 hccapx 格式了,之前的 hccap 格式已經不支持了[hashcat cap2hccapx - advanced password recovery](https://hashcat.net/cap2hccapx/)
hashcat -a 3 -m 2500 1.hccapx 1391040?d?d?d?d

# 查看已經破解的密碼
hashcat hash --show

0x0四、Reference

Hashcat - advanced password recoverygithub

Hashcat的使用手冊總結 - 先知社區sql

快速破解各類散列 hash - klion's blogbash

相關文章
相關標籤/搜索