John the Ripper教學

【完整指南】John the Ripper 破解 ZIP、WinRAR、7-Zip 壓縮加密檔

實作John the Ripper破解壓縮加密檔時間記錄

電腦設備
CPU:AMD 5600X GPU:NVIDIA RTX 2080 SUPER
ZIP(ZipCrypto) WinRAR(AES) 7-zip(AES)
爆力破解6位數字密碼 32秒 5分03秒 34分02秒
爆力破解8位小寫字母與數字 15.2小時 11天 90天
字典檔破解8位小寫字母與數字 1秒內 1秒內 7秒

破解軟體比較
John the Ripper HashCat
爆力破解6位數字密碼(7-zip) 34分02秒 21分35秒

操作指令

[John the Ripper]
//下載安裝John the Ripper
https://www.openwall.com/john/
1.9.0-jumbo-1 64-bit Windows

//產生密碼
512576


//破解ZIP密碼
zip2john.exe test.zip >  test.zip.txt
john --incremental test.zip.txt
john --mask=[a-z0-9][a-z0-9][a-z0-9][a-z0-9][a-z0-9][a-z0-9][a-z0-9][a-z0-9] test-wordlist.zip.txt
john --wordlist=password.lst test-wordlist.zip.txt

//破解WinRAR密碼
rar2john test.rar > test.rar.txt
rar2john test.rar >  test.rar.txt
john --incremental test.rar.txt
john --mask=?d?d?d?d?d?d --format=rar5 test.rar.txt

rar2john test-wordlist.rar >  test-wordlist.rar.txt
john --mask=[a-z0-9][a-z0-9][a-z0-9][a-z0-9][a-z0-9][a-z0-9][a-z0-9][a-z0-9] --format=rar5 test-wordlist.rar.txt
john --wordlist=password.lst test-wordlist.rar.txt

//破解7-zip密碼
//下載安裝perl
https://strawberryperl.com/
perl 7z2john.pl test.7z > test.7z.txt
john --mask=?d?d?d?d?d?d test.7z.txt

//使用字典檔破解
設定密碼
q1w2e3r4

網路搜尋 password.lst 或 rockyou.txt 下載常用的密碼字典檔
perl 7z2john.pl test-wordlist.7z > test-wordlist.7z.txt
john --wordlist=password.lst test-wordlist.7z.txt
john --mask=[a-z0-9][a-z0-9][a-z0-9][a-z0-9][a-z0-9][a-z0-9][a-z0-9][a-z0-9] test-wordlist.7z.txt


若電腦有獨立顯卡用另一套軟體HashCat破解密碼可能會更快些
將hash檔(例如:test.7z.txt)裡的hash值取出改由hashcat來執行

[Hashcat]
https://hashcat.net/hashcat/
hashcat -m 11600 -a 3 test.7z.txt ?d?d?d?d?d?d
hashcat -m 11600 -a 3 test-wordlist.7z.txt password.lst

John the Ripper 是什麼?

John the Ripper (簡稱 JtR) 是一款強大的密碼破解工具,專為弱密碼、字典攻擊和暴力破解而設計。它支援多種檔案格式,特別擅長破解 ZIP、WinRAR 和 7-Zip 等壓縮檔。

為何選擇 John the Ripper 破解壓縮檔?

  • 開源免費:John the Ripper 是免費的開源工具,擁有龐大的社群支持。
  • 強大靈活:支援多種破解模式,包括字典攻擊、混合攻擊等。
  • 兼容性高:可在 Windows、Linux、MacOS 等多種系統上使用。

支援的壓縮檔類型

John the Ripper 支援以下壓縮檔格式:

  • ZIP (.zip)
  • WinRAR (.rar)
  • 7-Zip (.7z)
  • RAR5 (新版 WinRAR 格式)

如何安裝 John the Ripper?

Windows 平台安裝指南

1. 下載 John the Ripper 官方版本

2. 解壓縮檔案至任意資料夾。

3. 開啟 cmd 並導航至安裝目錄。

4. 輸入以下命令以測試安裝是否成功:

john --test

Linux 平台安裝指南


sudo apt update
sudo apt install john
john --test
        

MacOS 平台安裝指南


brew install john
john --test
        

John the Ripper 破解 ZIP 壓縮檔教學

ZIP 檔案的準備工作

將 ZIP 檔案轉換為 hash 檔案,執行以下命令:

zip2john protected.zip > hash.txt

破解 ZIP 壓縮檔的指令示範

john hash.txt --wordlist=/path/to/wordlist.txt

提升 ZIP 破解效率的技巧

  • 使用更大的字典檔案 (如 rockyou.txt)。
  • 利用 --incremental 模式執行更全面的破解。

破解壓縮檔的常見問題 (FAQ)

1. John the Ripper 無法找到密碼,該怎麼辦?

嘗試更大的字典檔案或使用 --incremental 模式。

2. ZIP 檔案已加密且已損壞,是否還能破解?

可能需要使用其他修復工具搭配 John the Ripper。

3. 破解速度慢,如何加速?

使用 GPU 加速工具 (如 hashcat) 或優化字典檔。

4. Windows 上 John the Ripper 命令無反應?

檢查是否已安裝所有依賴程式,或重新啟動 cmd。

5. 破解 WinRAR 的 RAR5 格式支援嗎?

支援,但 RAR5 相較於舊版 RAR 更難破解。

6. 破解行為是否合法?

請勿用於非法用途,破解行為僅限於忘記密碼的合法情況。

結論

John the Ripper 是一款強大、靈活的密碼破解工具,尤其在破解 ZIP、WinRAR、7-Zip 等壓縮檔案時表現優秀。請確保在合法合規的情況下使用,以保障個人隱私與數據安全。