ispectr3/hashcracker
GitHub: ispectr3/hashcracker
一款基于 Go 的哈希破解工具,支持自动识别多种哈希类型并通过字典或暴力方式进行破解。
Stars: 0 | Forks: 0
# Hash 破解



## 功能
- **自动识别** — 根据格式和长度检测 MD5、SHA1、SHA256、SHA512 和 bcrypt
- **字典攻击** — 使用 worker pool 测试字典中的密码
- **暴力破解** — 使用可配置的字符集和长度生成组合
- **Goroutines** — 可调线程数的并行处理
- **进度指示器** — 显示尝试次数、速度(hash/s)和百分比
- **多重 Hash** — 一次性破解文件中的多个 hash
- **彩色输出** — 带有 ANSI 颜色的美观终端界面
## 前置条件
- 已安装 [Go 1.21+](https://golang.org/dl/)
## 安装说明
```
git clone https://github.com/kaique/hashcracker-go.git
cd hashcracker-go
go build -o hashcracker main.go
```
## 使用说明
### 使用字典识别并破解 hash
```
./hashcracker -hash "5f4dcc3b5aa765d61d8327deb882cf99" -wordlist wordlists/common.txt
```
### 暴力破解
```
./hashcracker -hash "e10adc3949ba59abbe56e057f20f883e" -mode brute -charset "abcdefghijklmnopqrstuvwxyz0123456789" -min-len 1 -max-len 6
```
### 从文件中破解多个 hash
```
./hashcracker -file hashes.txt -wordlist wordlists/common.txt -threads 16
```
### 参数标志
| 参数标志 | 描述 | 默认值 |
|------|-----------|--------|
| `-hash` | 要破解的单个 hash | — |
| `-file` | 包含多个 hash 的文件 | — |
| `-wordlist` | 字典的路径 | `wordlists/common.txt` |
| `-mode` | 模式:`dict` 或 `brute` | `dict` |
| `-charset` | 暴力破解的字符集 | `a-z0-9` |
| `-min-len` | 最小长度(暴力破解) | `1` |
| `-max-len` | 最大长度(暴力破解) | `6` |
| `-threads` | goroutine 数量 | `8` |
## 项目结构
```
hashcracker-go/
main.go # Entry point, flags e banner
cracker/
identifier.go # Identificação do tipo de hash
hasher.go # Funções de hashing (MD5, SHA1, SHA256, SHA512)
dictionary.go # Lógica do ataque por dicionário
bruteforce.go # Lógica do ataque brute force
wordlists/
common.txt # Top 10.000 senhas mais comuns
go.mod
README.md
LICENSE
.gitignore
```
## 工作原理
### Hash 识别
`identifier.go` 模块分析 hash 的长度和格式:
| 类型 | 长度 | 示例 |
|------|-------------|---------|
| MD5 | 32 字符 | `5f4dcc3b5aa765d61d8327deb882cf99` |
| SHA1 | 40 字符 | `5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8` |
| SHA256 | 64 字符 | `5e884898da2803...` |
| SHA512 | 128 字符 | `b109f3bbbc244...` |
| bcrypt | 前缀 `$2a$` | `$2a$10$...` |
### Worker Pool (Goroutines)
攻击使用 **生产者-消费者** 模式:
1. **生产者**:读取字典或生成组合
2. **通道**:分发候选密码
3. **Workers (goroutines)**:计算 hash 并与目标进行比对
```
[Wordlist] → [Canal] → [Worker 1] → compara hash
→ [Worker 2] → compara hash
→ [Worker N] → compara hash
```
## 测试 Hash
```
# "password" 的 MD5
echo "5f4dcc3b5aa765d61d8327deb882cf99" | ./hashcracker -hash -
# "123456" 的 SHA256
./hashcracker -hash "8d969eef6ecad3c29a3a629280e686cf0c3f5d5a86aff3ca12020c923adc6c92"
```
## 免责声明
## 许可证
本项目采用 [MIT](LICENSE) 许可协议。
标签:DOS头擦除, EVTX分析, Go, Ruby工具, SysWhispers, 密码学, 密码破解, 手动系统调用, 日志审计, 用户模式钩子绕过