# John the Ripper

**John the Ripper** 是一款免费开源的密码破解工具，其主要用途是通过从密码哈希中恢复密码来检测弱 Unix 密码。它由 Solar Designer（Alexander Peslyak）开发和维护，后者持有 1996 年至 2019 年的版权，依据 GNU 通用公共许可证第 2 版或更高版本分发<sup>[1](https://openwall.com/john/doc/LICENSE.shtml)</sup><sup> • </sup><sup>[2](https://openwall.com/john/doc/CREDITS.shtml)</sup>。该程序可运行于多种 Unix 变体、macOS、Windows、DOS、BeOS 和 [OpenVMS](https://www.edgepedia.org/zh/openvms)（后者需要社区贡献的补丁），除 Unix crypt(3) 哈希类型外，开箱即支持 Kerberos/AFS、Windows LM 哈希和基于 DES 的识别码<sup>[3](https://openwall.com/john/doc/)</sup>。社区增强的“jumbo”版本额外增加了数百种哈希和加密类型<sup>[3](https://openwall.com/john/doc/)</sup>。

| 关键事实 | 详情 |
|---|---|
| 作者与许可证 | 版权所有 (c) 1996-2019，Solar Designer（Alexander Peslyak）；GNU GPL v2 或更高版本，附有允许与 OpenSSL 和 unRAR 链接的特殊例外<sup>[1](https://openwall.com/john/doc/LICENSE.shtml)</sup> |
| 平台 | 多种 Unix 变体、macOS、Windows、DOS、BeOS 和 OpenVMS（需社区贡献的补丁）<sup>[3](https://openwall.com/john/doc/)</sup> |
| 破解模式 | “单破解”（Single crack）、字典（配合变形规则）、“增量”（incremental），以及用类 C 配置语言定义的外部模式；默认运行按此顺序依次尝试<sup>[4](https://openwall.com/john/doc/MODES.shtml)</sup><sup> • </sup><sup>[5](https://openwall.com/john/doc/FAQ.shtml)</sup> |
| 格式支持 | 核心支持基于 DES、bigcrypt、BSDI 扩展 DES、FreeBSD MD5、OpenBSD Blowfish 的 crypt(3) 类型，以及 Kerberos/AFS、Windows LM 和识别码；jumbo 版额外增加数百种，包括 NTLM、SSH 私钥、ZIP、RAR、7z、PDF 和 Microsoft Office 文件<sup>[3](https://openwall.com/john/doc/)</sup> |
| 会话管理 | 已破解的密码存储在 $JOHN/john.pot 中，用 --show 显示；中断的会话保存到 john.rec，默认每 10 分钟保存一次，用 --restore 恢复<sup>[3](https://openwall.com/john/doc/)</sup> |
| 并行处理 | 自 1.8.0 版起，--fork 在类 Unix 系统上派生多个进程，--node 支持一种简单的分布式处理形式；两者可组合使用<sup>[5](https://openwall.com/john/doc/FAQ.shtml)</sup> |
| 近期版本 | 1.9.0-jumbo-1（2019 年 5 月）和 1.9.1-ce（2025 年 2 月 1 日），后者以 Docker、Flatpak、Snap、macOS 和 Windows 二进制形式分发<sup>[6](https://www.openwall.com/lists/announce/2019/05/14/1)</sup><sup> • </sup><sup>[7](https://github.com/openwall/john-packages/blob/main/RELEASE-NOTES.md)</sup> |

## 用途与合法使用

John the Ripper 通过尝试从哈希、加密文件和凭据数据库中恢复密码来测试密码强度<sup>[8](https://www.esecurityplanet.com/products/john-the-ripper/)</sup>。在合法的安全评估中，这可以在攻击者之前发现弱密码选择；该工具应仅用于操作者有权测试的密码或哈希<sup>[9](https://cybersnowden.com/john-the-ripper-vs-hashcat/)</sup>。评测文章将其描述为一款面向系统管理员和习惯从源码编译软件的用户使用的命令行工具，而非面向偶尔需要恢复遗忘密码的普通用户<sup>[10](https://www.itpro.com/software/368078/john-the-ripper-password-cracker-review)</sup>。

## 破解模式

**字典模式**是最简单的模式：操作者提供一个文本文件，每行一个候选词，可选的词语变形规则对每个词进行修改以产生更多可能的密码，因此一个源词可以生成多个候选<sup>[4](https://openwall.com/john/doc/MODES.shtml)</sup>。John 不会对字典排序，从而保留操作者将更可能的候选排在前面的顺序<sup>[4](https://openwall.com/john/doc/MODES.shtml)</sup>。

**“单破解”模式**是推荐的起始模式。它使用每个账户的登录名、GECOS（“全名”）字段和主目录名作为候选密码，并始终启用大量变形规则。由于候选只针对其来源的哈希（以及共享相同盐值的哈希）进行尝试，该模式比字典模式快得多，且猜出的密码还会对所有已加载的哈希进行尝试，以防多个用户共用同一密码<sup>[4](https://openwall.com/john/doc/MODES.shtml)</sup>。

**“增量”模式**是最强大的模式，可以尝试所有可能的字符组合作为密码。由于组合数量太大，运行无法在合理时间内终止（除非将长度上限设得很低或使用很小的字符集），操作者需手动中断；该模式利用三字符序列（trigraph）的频率来排序候选（三字符序列的频率用于排序密码猜测），频率数据按字符位置和密码长度分别存储，以便在有限时间内破解尽可能多的密码<sup>[4](https://openwall.com/john/doc/MODES.shtml)</sup>。截至 1.8.0 版，预定义的增量模式包括“ASCII”（全部 95 个可打印 ASCII 字符）、“Alnum”（62 个字母数字字符）、“Alpha”（52 个字母）、“LowerNum”和“UpperNum”（各 36 个）、“LowerSpace”（27 个）、“Lower”、“Upper”、“Digits”，以及用于 LM 哈希的“LM_ASCII”；随附的 .chr 频率文件对大多数模式覆盖长度最多 13，对“Digits”覆盖最多 20<sup>[4](https://openwall.com/john/doc/MODES.shtml)</sup>。

**外部模式**允许操作者在配置文件的节中用 C 语言的一个子集定义候选生成逻辑，John 在启动时编译这些节。该节定义 init()、filter()、generate() 和 restore() 等函数，它们操作一个保存当前候选的全局“word”变量<sup>[11](https://openwall.com/john/doc/EXTERNAL.shtml)</sup>。

未指定模式时，默认运行依次执行“单破解”模式（第 1 遍）、字典模式（第 2 遍）和“增量”模式（第 3 遍），并在状态行报告遍数<sup>[5](https://openwall.com/john/doc/FAQ.shtml)</sup>。“单破解”运行通常从不到一秒到一天不等，取决于哈希类型和数量；字典运行则从不到一秒到数天不等，取决于字典大小、变形规则和慢速哈希类型<sup>[5](https://openwall.com/john/doc/FAQ.shtml)</sup>。

## 格式支持与 jumbo 版

核心版本自动检测实际环境中最常见的 Unix crypt(3) 哈希类型：传统基于 DES、bigcrypt、BSDI 扩展 DES、FreeBSD 基于 MD5（也用于 Linux 和 [Cisco IOS](https://www.edgepedia.org/zh/cisco-ios)）以及 OpenBSD 基于 Blowfish 的哈希，外加 Kerberos/AFS、Windows LM 和基于 DES 的识别码。在 glibc 2.7 或更新版本的系统上，John 1.7.6+ 还支持并自动检测 SHA-crypt 哈希，可选 OpenMP 并行化<sup>[3](https://openwall.com/john/doc/)</sup>。

jumbo（“社区增强”）版额外增加数百种哈希和加密类型：Windows NTLM（基于 MD4）密码哈希、多种 macOS 用户密码哈希、快速原始 MD5、SHA-1、SHA-256 和 SHA-512 哈希（Web 应用历史上曾误用于密码）、SQL 和 LDAP 服务器哈希，以及非哈希格式如 SSH 私钥、Kerberos TGT、加密的 macOS .dmg 文件和稀疏包、加密归档（经典 PKZIP 和 WinZip/AES、RAR、7z）以及加密文档如 PDF 和 [Microsoft Office](https://www.edgepedia.org/zh/microsoft-office) 文件<sup>[3](https://openwall.com/john/doc/)</sup>。IT Pro 的一篇评测统计 jumbo 版可破解超过 411 种密码类型，从 Unix 密码和数据库到 iTunes 备份和 Wi-Fi 密码<sup>[10](https://www.itpro.com/software/368078/john-the-ripper-password-cracker-review)</sup>。要加载较大的文件，需先运行相应的捆绑 *2john 提取程序，将其输出送入 jumbo 版 John<sup>[3](https://openwall.com/john/doc/)</sup>。

Windows LM 哈希和基于 DES 的 bigcrypt 等设计不佳的哈希类型有一个特点：John 在加载时将其编码拆分为两个独立的哈希，分别对应明文密码的两半，并分别破解；这就是为什么 John 可能报告加载的哈希数量多于用户数量<sup>[5](https://openwall.com/john/doc/FAQ.shtml)</sup>。

## 操作与会话管理

基本运行需提供密码文件，可选指定模式，例如 `john --wordlist=password.lst --rules passwd`<sup>[3](https://openwall.com/john/doc/)</sup>。破解出的密码打印到终端并保存在 $JOHN/john.pot 中，这也能防止下次运行时重复加载已破解的哈希；`john --show passwd` 以可读形式显示恢复的密码<sup>[3](https://openwall.com/john/doc/)</sup>。运行中按任意键显示状态，按 'q' 或 Ctrl-C 中止并将会话状态保存到 $JOHN/john.rec；再按一次 Ctrl-C 立即中止且不保存。状态还每 10 分钟保存一次，以便崩溃后恢复，`john --restore` 可继续中断的会话<sup>[3](https://openwall.com/john/doc/)</sup>。

截至 1.8.0 版，状态行可显示成功猜测数（“g”）、会话时长、带遍数的进度指示、最多四项速度指标（g/s 为每秒猜测数，p/s 为每秒测试的候选密码数，c/s 为每秒哈希计算数，C/s 为每秒候选-哈希组合数），以及当前正在测试的候选范围<sup>[5](https://openwall.com/john/doc/FAQ.shtml)</sup>。“--test”选项对哈希例程进行基准测试，报告实际和虚拟 c/s 速率<sup>[5](https://openwall.com/john/doc/FAQ.shtml)</sup>。

## 并行与 GPU 处理

自 1.8.0 版起，类 Unix 系统上的“--fork”选项可利用单台系统中的多个 CPU 或核心，所有系统上的“--node”选项允许一种简易的分布式处理形式；两者可结合使用<sup>[5](https://openwall.com/john/doc/FAQ.shtml)</sup>。对于快速哈希，John 的多线程效率不高，使用 --fork=4 启动四个独立进程比四个线程的累计性能好得多<sup>[12](https://hashsuite.openwall.net/performance)</sup>。社区项目还增加了基于 MPI 的集群支持，列在 Openwall 维基上<sup>[5](https://openwall.com/john/doc/FAQ.shtml)</sup>。

GPU 支持存在但需要额外依赖；IT Pro 指出，使用 NVIDIA GPU 运行 John 需要下载约 4 GB 的额外软件，并非所有哈希格式都能在显卡上破解，且 GPU 破解速度可达 CPU 的 10 倍<sup>[10](https://www.itpro.com/software/368078/john-the-ripper-password-cracker-review)</sup>。

## John the Ripper 与 Hashcat

John the Ripper 和 Hashcat 是两款标准的离线密码破解工具，各有所长。Hashcat 通常是 GPU 加速恢复和大规模哈希测试的更好选择，而 John 在识别哈希类型、处理复杂密码格式和应用精细词语变形规则方面极为灵活；在纯 CPU 环境中 John 具有竞争力，有时更优<sup>[9](https://cybersnowden.com/john-the-ripper-vs-hashcat/)</sup><sup> • </sup><sup>[13](https://securityelites.com/hashcat-vs-john-speed-comparison-2026/)</sup>。jumbo 版通过其 *2john 提取程序在加密文件和应用程序格式方面远超 Hashcat，覆盖归档、文档、密码管理器、SSH 密钥和加密货币钱包<sup>[14](https://techearl.com/hashcat-vs-john-the-ripper)</sup>。同时拥有两款工具的渗透测试人员的常见做法是不永久选定其一：用 John 处理广泛的格式和灵活的密码分析，当 GPU 密集型候选测试是优先事项时使用 Hashcat<sup>[9](https://cybersnowden.com/john-the-ripper-vs-hashcat/)</sup>。

## 分发与相关项目

主要源码仓库是 GitHub 上的 openwall/john，托管 jumbo 版，约有 13.8k 星标<sup>[15](https://github.com/openwall/john)</sup>。openwall/john-packages 项目将 1.9.1-ce 版（2025 年 2 月 1 日）发布为 Docker 镜像（通过 OpenCL 支持 NVIDIA GPU）、Flatpak、Snap、macOS（M1 及以后）和 Windows x86_64 二进制<sup>[7](https://github.com/openwall/john-packages/blob/main/RELEASE-NOTES.md)</sup>。偏好图形界面的用户可使用名为 Johnny 的跨平台开源图形界面<sup>[10](https://www.itpro.com/software/368078/john-the-ripper-password-cracker-review)</sup>，面向 Linux 和 macOS 的商业版 John the Ripper Pro 则增加了安装支持<sup>[16](https://www.techradar.com/best/password-recovery-solutions)</sup>。

## References

1. [John the Ripper - copyright and licensing terms, Openwall](https://openwall.com/john/doc/LICENSE.shtml)
2. [John the Ripper - credits, Openwall](https://openwall.com/john/doc/CREDITS.shtml)
3. [John the Ripper documentation, Openwall](https://openwall.com/john/doc/)
4. [John the Ripper - cracking modes, Openwall](https://openwall.com/john/doc/MODES.shtml)
5. [John the Ripper - frequently asked questions, Openwall](https://openwall.com/john/doc/FAQ.shtml)
6. [John the Ripper 1.9.0-jumbo-1 announcement, Openwall announce list](https://www.openwall.com/lists/announce/2019/05/14/1)
7. [john-packages RELEASE-NOTES.md, GitHub](https://github.com/openwall/john-packages/blob/main/RELEASE-NOTES.md)
8. [John the Ripper: Beginner's Tutorial and Review, eSecurity Planet](https://www.esecurityplanet.com/products/john-the-ripper/)
9. [John the Ripper vs Hashcat: Which Is Better?, Cyber Snowden](https://cybersnowden.com/john-the-ripper-vs-hashcat/)
10. [John the Ripper password cracker review, IT Pro](https://www.itpro.com/software/368078/john-the-ripper-password-cracker-review)
11. [John the Ripper - defining an external mode, Openwall](https://openwall.com/john/doc/EXTERNAL.shtml)
12. [Hash Suite performance page, Openwall](https://hashsuite.openwall.net/performance)
13. [Hashcat vs John the Ripper: The Speed Gap, Security Elites](https://securityelites.com/hashcat-vs-john-speed-comparison-2026/)
14. [Hashcat vs John the Ripper: Which Should You Use?, TechEarl](https://techearl.com/hashcat-vs-john-the-ripper)
15. [openwall/john repository, GitHub](https://github.com/openwall/john)
16. [Best Password Recovery Software, TechRadar](https://www.techradar.com/best/password-recovery-solutions)

---
*Initially written Sep 17, 2026 · Reviewed: Sep 17, 2026; Oct 15, 2026 · Edited: Oct 15, 2026 · Last review: Oct 15, 2026*

Topic: 技术与人造世界 › 计算技术与数字系统 › 网络与安全 › Titles 2 to Ma

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/john-the-ripper

English original: https://www.edgepedia.org/john-the-ripper
