返回更新列表
新发布Sep 4, 2026

hate_crack v2.36.1

TrustedSec 团队开发的一款通过 Hashcat 自动化执行破解方法的工具。

分享
  ___ ___         __             _________                       __
 /   |   \_____ _/  |_  ____     \_   ___ \____________    ____ |  | __
/    ~    \__  \\   __\/ __ \    /    \  \/\_  __ \__  \ _/ ___\|  |/ /
\    Y    // __ \|  | \  ___/    \     \____|  | \// __ \\  \___|    <
 \___|_  /(____  /__|  \___  >____\______  /|__|  (____  /\___  >__|_ \
       \/      \/          \/_____/      \/            \/     \/     \/

安装

从源码安装是唯一受支持的途径。hate_crack 不在 PyPI 上分发:pip install hate-crack 会解析到一个 0.0.0 占位包,该包会故意失败并指向此处。保留该名称只是为了防止其他人在其下发布仿冒包——参见 packaging/pypi-placeholder/。

1. 安装 hashcat

Hashcat 必须已安装并可在你的 PATH 中使用:

Ubuntu/Kali:

sudo apt-get install -y hashcat

macOS(Homebrew):

brew install hashcat

或者从 https://hashcat.net/hashcat/ 下载预编译的二进制文件,并在 config.json 中将 hcatPath 设置为其所在位置。

2. 下载 hate_crack

使用子模块进行克隆(hashcat-utils、princeprocessor、pcfg_cracker、Corporate_Masks 以及可选的 omen 所必需):

git clone --recurse-submodules https://github.com/trustedsec/hate_crack.git
cd hate_crack

如果克隆时未包含子模块,请初始化它们:

git submodule update --init --recursive

然后根据需要自定义配置。hate_crack 使用两个配置文件,各自拥有一组不同的设置:

  • config.json — 字典路径、掩码、规则、调优、potfile、hashcat 路径、候选数量限制、通知开关、CLI 偏好默认值(35 项设置)。
  • .env — 仅包含第三方集成设置:Hashview 和 Hashmob 凭据、Pushover 凭据、Ollama 和 pipal(14 项设置)。不被 git 跟踪,以 0600 权限模式创建。

这条分界线存在的原因只有一个:.env 是可以存放机密信息的文件。第三方服务的凭据及其配置放在未被跟踪的 0600 文件中;hate_crack 在本地执行的所有操作都保留在 config.json 中,该文件可以安全地共享、进行差异比较并记录到你自己的笔记中。这也是为什么 Pushover 的凭据位于 .env 中,而 Pushover 的开启/关闭开关位于 config.json 中——开关属于本地偏好设置,而非机密信息。

每个键都有且仅有一个归属文件。放在另一个文件中的键会被忽略,hate_crack 会打印一条警告,指明该键所属的文件。任何键仍然可以通过导出其环境变量在单次运行中被覆盖。大多数用户可以跳过此步骤,因为默认路径开箱即用。

config.json 是永久且一等公民——它并未被弃用,也没有移除时间表。只有集成设置被迁移了。

从单个 config.json 升级? hate_crack 会在首次运行时为你迁移:集成设置会被复制到新的 0600 .env 中,然后从 config.json 中移除,以免两个文件都声称拥有它们。它会打印出哪些键被迁移了(绝不打印其值),并在改动之前将你的原始文件保存为 config.json.pre-split.bak。config.json 中的其他所有内容都保持原样,包括键的顺序。

首次运行: hate_crack 会为你创建这两个文件,因此无需任何操作。若要改为手动设置 .env,请复制被跟踪的模板:

cp .env.example .env
chmod 600 .env

.env.example 已提交,并且随附的每个凭据键均为空。.env 本身绝不能被提交——它已被 gitignore,连同其常见的备份拼写形式,并且 hate_crack 始终以 0600 模式(仅所有者可读写)创建它。.env.example 由 schema 生成;在修改 hate_crack/config_schema.py 后,使用 uv run python -m hate_crack.config_writer 重新生成它。

3. 安装依赖项和 hate_crack

最简单的方法是运行 make(或 make install),它会自动检测你的操作系统并安装:

  • 外部依赖项(p7zip、transmission-daemon / transmission-remote)
  • 构建子模块(hashcat-utils、princeprocessor、pcfg_cracker,以及可选的 omen),并检出仅含数据的 Corporate_Masks 掩码集
  • 通过 uv 安装 Python 依赖项,并在 ~/.local/bin/hate_crack 处创建 CLI 垫片
make

这是幂等的——它会跳过已安装的工具。要强制进行全新重装:

make reinstall

或手动安装依赖:

外部依赖

这些是某些下载/解压流程所必需的:

  • 7z/7za (p7zip) — 用于解压 .7z 归档文件。
  • transmission-daemon / transmission-remote — 用于下载 Weakpass 种子文件。

手动安装命令:

Ubuntu/Kali:

sudo apt-get update
sudo apt-get install -y p7zip-full transmission-daemon

macOS(Homebrew):

brew install p7zip transmission-cli  # provides transmission-daemon and transmission-remote

然后安装 Python 依赖项和 CLI 垫片:

uv sync
mkdir -p ~/.local/bin
printf '#!/usr/bin/env bash\nset -euo pipefail\nexec uv run --directory %s python -m hate_crack "$@"\n' "$(pwd)" > ~/.local/bin/hate_crack
chmod +x ~/.local/bin/hate_crack

项目结构

核心逻辑现已拆分为 hate_crack/ 下的多个模块:

  • hate_crack/cli.py:argparse 辅助函数和配置覆盖。
  • hate_crack/api.py:Hashview、Weakpass 和 Hashmob 集成(下载/菜单/辅助函数)。
  • hate_crack/attacks.py:菜单攻击处理器。
  • hate_crack/corpus_stats.py:用于向 LLM 描述语料库的全语料库密码统计。
  • hate_crack/plaintext.py:从语料库行中恢复密码(哈希前缀剥离、$HEX[...] 解码);由 LLM 模式、corpus_stats 和 rulegen 共享。
  • hate_crack/llm.py:通过 Atomic Agents 生成结构化(JSON)LLM 候选。
  • hate_crack/menu.py:共享菜单渲染器,包括可选的箭头键导航。
  • hate_crack/noninteractive.py:脚本化攻击子命令的分发器。
  • hate_crack/notify/:通知包(Pushover 后端、每次破解的 tailer)。
  • hate_crack/username_detect.py:检测 username:hash 输入文件,以决定 hashcat 的 --username。
  • hate_crack/formatting.py、hate_crack/progress.py:输出格式化和进度显示辅助函数。
  • hate_crack/main.py:主 CLI 实现。

顶层的 hate_crack.py 仍然是主入口点,并协调这些模块。


参考资料与致谢

本项目依赖并受多个外部项目和服务启发。感谢:


用法

使用 make 安装后,可从任意位置运行 hate_crack:

hate_crack
# or with arguments:
hate_crack <hash_file> <hash_type> [options]

或者,通过 uv 运行:

uv run hate_crack.py <hash_file> <hash_type>

作为工具运行(推荐)

在仓库根目录使用 make 进行安装——这会构建子模块并打包资源:

cd /path/to/hate_crack
make
hate_crack

make install 命令会在 ~/.local/bin/hate_crack 创建一个 bash shim,该 shim 从仓库目录运行,因此无论你当前的工作目录是什么,配置和资源都能被找到。

配置还会在以下位置搜索:

  • 仓库根目录和包目录
  • ~/.hate_crack

注意: config.json 中的 hcatPath 仅用于指定 hashcat 二进制文件的位置(如果 hashcat 已在 PATH 中,则此项可选)。Hate_crack 资源(hashcat-utils、princeprocessor、pcfg_cracker、Corporate_Masks、omen)从仓库目录加载,并由 make install 自动打包。

作为脚本运行

该脚本使用 uv shebang。使其可执行并运行:

chmod +x hate_crack.py
./hate_crack.py

你也可以直接使用 Python:

python hate_crack.py

非交互式 / 脚本化使用

对于自动化场景,你可以直接启动单次攻击,绕过菜单。攻击名称是第一个参数,后面跟着哈希文件和 hashcat 哈希类型。预处理提示(计算机账户过滤、LM 优先暴力破解、重复账户去重)在此模式下自动接受其默认值。进程在成功时退出码为 0,出错时(哈希文件缺失、哈希类型非数字、字典文件缺失或规则文件名未知)退出码为非零。

# Quick crack: one wordlist + optional rule(s) from the rules directory
hate_crack quick hashes.txt 1000 --wordlist rockyou.txt --rules best64.rule

# Chain two rules in a single run
hate_crack quick hashes.txt 1000 --wordlist rockyou.txt --rules best64.rule+d3ad0ne.rule

# Run two rules as two separate passes
hate_crack quick hashes.txt 1000 --wordlist rockyou.txt --rules best64.rule d3ad0ne.rule

# Canned dictionary methodology (uses your configured wordlists)
hate_crack dict hashes.txt 1000

# Brute force lengths 1-8
hate_crack brute hashes.txt 1000 --min 1 --max 8

# Top-mask attack targeting ~4 hours
hate_crack topmask hashes.txt 1000 --target-time 4

菜单中的大多数攻击都以相同方式可用。这些只需要哈希文件和哈希类型:

hate_crack fingerprint hashes.txt 1000
hate_crack pathwell    hashes.txt 1000
hate_crack prince      hashes.txt 1000
hate_crack pcfg        hashes.txt 1000
hate_crack princeling  hashes.txt 1000
hate_crack smartmask   hashes.txt 1000
hate_crack corporate   hashes.txt 1000
hate_crack combinator  hashes.txt 1000     # configured wordlists
hate_crack hybrid      hashes.txt 1000     # configured wordlists

每个选项也接受其菜单项所提示的设置:

# Fingerprint, tuned: escalate to 24-character fragments and cap the keyspace
hate_crack fingerprint hashes.txt 1000 --max-expander-len 24 \
    --run-hybrid-on-expanded --keyspace-limit 50000000000

# Skip the fragment/wordlist combination step entirely
hate_crack fingerprint hashes.txt 1000 --no-dictionary-wordlist

# Override the configured wordlists (combinator needs at least two).
# Two wordlists use combinator, three use combinator3, more -- or any
# --separator -- use combinatorX, matching what the menu does.
hate_crack combinator hashes.txt 1000 --wordlist first.txt second.txt
hate_crack combinator hashes.txt 1000 --wordlist a.txt b.txt c.txt
hate_crack combinator hashes.txt 1000 --wordlist a.txt b.txt --separator -
hate_crack hybrid     hashes.txt 1000 --wordlist rockyou.txt

# Corporate masks, lengths 8-12 only
hate_crack corporate hashes.txt 1000 --min 8 --max 12

# Smart mask, skipping templates over 10 billion candidates
hate_crack smartmask hashes.txt 1000 --keyspace-limit 10000000000

其余工具则接收其菜单项所要求的那一个输入:

# Bandrel methodology (comma-separate multiple companies)
hate_crack bandrel hashes.txt 1000 --company "Acme,Acme Corp"

# Permutation attack over a short targeted wordlist
hate_crack permute hashes.txt 1000 --wordlist names.txt

分类