如何高效使用CTF压缩包题型中的4款核心工具?

摘要:一、John the Ripper(JtR):通用压缩包破解入门工具 核心定位 开源跨平台密码破解工具,CTF压缩包暴力破解的入门首选,支持ZIPRAR7Z等几乎所有主流压缩格式,核心逻辑为提取加密哈希→破解哈希,兼容性强、操作门槛低,
一、John the Ripper(JtR):通用压缩包破解入门工具 核心定位 开源跨平台密码破解工具,CTF压缩包暴力破解的入门首选,支持ZIP/RAR/7Z等几乎所有主流压缩格式,核心逻辑为提取加密哈希→破解哈希,兼容性强、操作门槛低,适合无GPU环境、简单密码的快速破解。 1. 全平台详细安装步骤 平台 详细安装&验证步骤 Kali Linux(首选) 1. 系统默认自带,直接打开终端验证:john --version,输出版本号即安装成功 2. 无自带则执行安装命令: sudo apt update && sudo apt install john -y 3. 解压必备通用字典rockyou.txt(CTF必用): sudo gunzip /usr/share/wordlists/rockyou.txt.gz 4. 验证字典路径:ls /usr/share/wordlists/rockyou.txt,有输出即正常 Windows 1. 前往JtR官网下载Windows OpenCL 预编译版 2. 解压到无中文、无空格的路径(如D:\Tools\john) 3. 按下Win+R,输入cmd打开命令提示符,执行cd D:\Tools\john\run进入运行目录 4. 验证:john.exe --version,输出版本号即成功 macOS 1. 安装Homebrew(已安装可跳过): /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" 2. 执行安装命令:brew install john 3. 验证:john --version 2. 核心操作:标准压缩包破解全流程(以ZIP为例,必学) 前置准备 将待破解的加密压缩包encrypted.zip放到终端当前工作目录(避免中文/空格路径)。 Step 1:提取压缩包加密哈希(必做,核心前置步骤) JtR不直接破解压缩包,需先提取和密码绑定的哈希值,剥离压缩包无关结构,提升破解效率。 # 核心命令:提取ZIP压缩包哈希,保存到zip.hash文件 zip2john encrypted.zip > zip.hash # 其他格式对应命令 rar2john encrypted.rar > rar.hash # RAR格式 7z2john encrypted.7z > 7z.hash # 7Z格式 操作验证:执行cat zip.hash,能看到以encrypted.zip:$zip2$开头的长字符串,即提取成功。 踩坑提示:若提示zip2john: 未找到命令,Kali执行sudo apt install john-data,Windows用完整路径zip2john.exe。 Step 2:字典攻击(CTF最常用,优先尝试) 用通用字典rockyou.txt破解哈希,60%的CTF压缩包密码可通过此方式破解。 # Linux/macOS 核心命令 john --wordlist=/usr/share/wordlists/rockyou.txt zip.hash # Windows 核心命令(run目录下执行) john.exe --wordlist=rockyou.txt zip.hash 成功输出示例:Using default input encoding: UTF-8 Loaded 1 password hash (ZIP, WinZip [PBKDF2-SHA1 256/256 AVX2 8x]) Cost 1 (iteration count) is 100000 for all loaded hashes Will run 4 OpenMP threads Press 'q' or Ctrl-C to abort, 'h' for help, almost any other key for status 123456 (encrypted.zip) 1g 0:00:00:01 DONE (2026-02-25 15:30) 0.8928g/s 10240p/s 10240c/s 10240C/s 123456 Use the "--show" option to display all of the cracked passwords reliably Session completed 其中123456就是压缩包的明文密码。
阅读全文