hash密码安全
以下是 zip2john、hashcat 和 rockyou.txt 的下载方法:
zip2john:zip2john 是 John the Ripper 工具集中的一个脚本。你可以从 John the Ripper 的官方网站https://www.openwall.com/john/下载 John the Ripper,也可以通过 GitHub 仓库https://github.com/magnumripper/JohnTheRipper下载其源码,然后进行编译安装。
hashcat:可以从 hashcat 的官方网站https://hashcat.net/hashcat/下载最新版本的压缩包。也可以通过其 GitHub 仓库https://github.com/hashcat/hashcat/releases下载。在 Linux 系统中,如 Kali Linux,还可以使用包管理工具直接安装,命令为 “apt update && apt install hashcat”。
rockyou.txt:可以从 GitHub 仓库https://github.com/brannondorsey/naive-hashcat/releases/download/data/rockyou.txt下载。也可以在 SecLists 存储库https://github.com/danielmiessler/SecLists中的 / Passwords/Leaked-Databases 下面找到 rockyou.txt。此外,在 Kali Linux 等渗透测试系统中,也可以在 /usr/share/wordlists 目录下找到 rockyou.txt.gz,使用 “gzip -d rockyou.txt.gz” 命令解压后即可使用。
结合前面提到的工具,破解 ZIP 文件密码的完整流程如下,以 Windows 和 Linux 系统为例:
准备工作
工具安装
步骤 1:提取 ZIP 文件的哈希值
用zip2john
从目标 ZIP 文件中提取加密信息(作为破解用的 “哈希”):
bash
# Windows命令(在John the Ripper的run目录下执行)
zip2john.exe C:\path\to\your\file.zip > hash.txt
# Linux命令
zip2john /path/to/your/file.zip > hash.txt
执行后,hash.txt
文件中会生成一行包含 ZIP 加密信息的文本(如file.zip:$zip2$*0*1*0*...
)。
步骤 2:用 hashcat 破解密码
使用 hashcat 加载提取的哈希值和字典文件进行破解:
bash
# Windows命令(在hashcat目录下执行)
hashcat.exe -m 17200 -a 0 hash.txt C:\path\to\rockyou.txt
# Linux命令
hashcat -m 17200 -a 0 hash.txt /path/to/rockyou.txt
参数说明
-m 17200
:指定哈希类型为 ZIP 文件(AES 加密,若为传统 ZipCrypto 加密用-m 13000
,hashcat 会自动识别)。-a 0
:表示使用字典攻击模式(最常用,适合用rockyou.txt
等字典)。hash.txt
:步骤 1 生成的哈希文件。rockyou.txt
:密码字典路径。
步骤 3:查看破解结果
破解成功后,hashcat 会显示密码,格式类似:
plaintext
$zip2$*0*1*0*...:password123
其中password123
就是 ZIP 文件的密码。若想重新查看结果,可执行:
bash
# Windows
hashcat.exe --show hash.txt
# Linux
hashcat --show hash.txt
补充说明
加密算法问题:
若 ZIP 用 AES 加密(较新格式),
-m 17200
适用;若为传统 ZipCrypto 加密(旧格式),用
-m 13000
。hashcat 会自动检测,若失败可尝试切换类型。
字典选择:
rockyou.txt
包含常见弱密码(如123456
、password
),适合破解简单密码;复杂密码需结合自定义字典(如生日、单词组合等)或暴力破解(
-a 3
模式)。
性能优化:
显卡(GPU)破解速度远快于 CPU,确保 hashcat 正确调用显卡(需安装对应驱动)。
按照以上步骤,即可利用zip2john
提取哈希、hashcat
结合rockyou.txt
字典破解 ZIP 文件密码。如果密码较简单,通常几分钟内就能出结果。