OhmRamwala/HashCracker
GitHub: OhmRamwala/HashCracker
一款基于 Linux 的多线程密码哈希破解工具,支持字典、暴力、规则及批量攻击,并提供断点续传能力。
Stars: 0 | Forks: 0
# HashCracker
`HashCracker` 是一个仅限 Linux 的多线程密码哈希破解工具,使用现代 C++ 结合 OpenSSL、Boost 和内存映射(mmap)字典扫描构建。
它主要为 Kali Linux 和其他现代 Linux 发行版设计,专注于:
- 使用 `mmap` 进行快速字典攻击
- 跨 CPU 线程的确定性暴力破解分区
- 基于规则的变异
- 使用 `--hash-file` 在单次运行中进行批量破解
- 支持通过 checkpoint 文件恢复暴力破解和字典会话
- 清晰的终端进度输出及哈希类型检测反馈
## 支持的哈希
- `md5`
- `sha1`
- `sha256`
- `sha512`
- `sha3-256`
- `sha3-512`
对于具有唯一摘要长度的哈希,支持自动检测。对于长度 ambiguous 的情况(如 `sha256` 与 `sha3-256`),请使用 `--type`。
## 主要平台
本项目针对 Linux 进行了优化。主要目标环境为:
- Kali Linux
- Ubuntu / Debian
- Arch Linux
- Fedora
字典路径使用 POSIX `mmap`、`madvise`,以及适用于 checkpoint 文件的 Linux 原子重命名语义。
## 构建
### 安装依赖
Kali、Debian、Ubuntu:
```
sudo apt update
sudo apt install -y build-essential cmake libssl-dev libboost-program-options-dev
```
Fedora:
```
sudo dnf install -y gcc-c++ make cmake openssl-devel boost-program-options
```
Arch:
```
sudo pacman -S --needed gcc make cmake openssl boost
```
如果 `cmake` 提示找不到 `Ninja`,请首先从此仓库拉取最新更改。预设现在使用 `Unix Makefiles`,因此不再需要 Ninja。
### 快速安装
```
./install.sh
```
这会安装依赖项,构建 release binary,并将其软链接到 `~/.local/bin/hashcracker`。
### 手动构建
```
cmake --preset release
cmake --build build/release
```
### 运行测试
```
cmake --preset debug
cmake --build build/debug
ctest --test-dir build/debug --output-on-failure
```
## 使用说明
### 字典攻击
```
hashcracker \
--hash 5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8 \
--wordlist wordlists/10k-most-common.txt
```
### 基于规则的攻击
```
hashcracker \
--hash ed9d3d832af899035363a69fd53cd3be8f71501c \
--wordlist wordlists/10k-most-common.txt \
--rules
```
### 暴力破解
```
hashcracker \
--hash 5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8 \
--bruteforce \
--charset lower \
--max-length 8
```
### SHA3 示例
```
hashcracker \
--hash c0067d4af4e87f00dbac63b6156828237059172d1bbeac67427345d6a9fda484 \
--type sha3-256 \
--wordlist wordlists/10k-most-common.txt
```
### 批量破解
```
hashcracker \
--hash-file tests/data/batch_hashes_sha256.txt \
--type sha256 \
--wordlist tests/data/small_wordlist.txt
```
### 可恢复的暴力破解
启动带有 checkpoint 的会话:
```
hashcracker \
--hash 5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8 \
--bruteforce \
--charset lower,digits \
--max-length 8 \
--checkpoint-file .hashcracker.chk
```
稍后恢复运行:
```
hashcracker \
--hash 5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8 \
--bruteforce \
--charset lower,digits \
--max-length 8 \
--checkpoint-file .hashcracker.chk \
--resume
```
### 可恢复的字典攻击
```
hashcracker \
--hash 5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8 \
--wordlist wordlists/10k-most-common.txt \
--checkpoint-file .hashcracker-dict.chk
```
恢复运行:
```
hashcracker \
--hash 5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8 \
--wordlist wordlists/10k-most-common.txt \
--checkpoint-file .hashcracker-dict.chk \
--resume
```
## Checkpoint 说明
- 暴力破解和字典攻击支持 checkpoint
- 规则模式目前特意设计为不可恢复
- 批量模式目前不支持 `--resume`
- Checkpoint 通过临时文件 + 重命名的方式原子写入
- 完成运行的 checkpoint 文件会自动删除
## 项目结构
```
src/
attack/ candidate generation strategies
core/ engine and concepts
display/ terminal progress UI
hash/ OpenSSL EVP hashers and detection
io/ mmap and checkpoint file helpers
rules/ mutation rules
threading/ thread pool and shared state
tests/ unit and integration tests
learn/ learning notes, architecture, and implementation docs
wordlists/ bundled sample wordlists
```
## GitHub 上传检查清单
推送之前:
```
cmake --preset debug
cmake --build build/debug
ctest --test-dir build/debug --output-on-failure
git status
```
推荐的首次推送:
```
git init
git add .
git commit -m "Initial commit"
git branch -M main
git remote add origin
git push -u origin main
```
## 学习
`learn/` 目录记录了该工具背后的理论和架构:
- `learn/00-OVERVIEW.md`
- `learn/01-CONCEPTS.md`
- `learn/02-ARCHITECTURE.md`
- `learn/03-IMPLEMENTATION.md`
## 许可证
MIT
此工具专为授权的安全测试、学术研究和 CTF 竞赛而开发。未经授权对不属于您的系统使用本工具是非法的。
标签:Bash脚本, C++, DOS头擦除, PoC, SysWhispers, VEH, 字典攻击, 安全测试工具, 密码破解, 数据擦除, 暴力破解, 用户模式钩子绕过