Skip to content

gatiella/hashcrack

Repository files navigation

HashCrack

A powerful, multi-threaded password cracking tool written in Go with support for multiple hash types, PCAP analysis, and custom transformation rules.

⚠️ Legal Disclaimer

This tool is intended for authorized security testing and educational purposes only. Unauthorized access to computer systems is illegal. Always ensure you have explicit written permission before testing any systems you do not own.

Features

  • 🔐 Multiple Hash Types: MD5, SHA1, SHA256, SHA512, BCrypt, NTLM
  • 📦 PCAP Analysis: Extract credentials from network captures (HTTP, FTP, Telnet, SMB)
  • 🔧 Rule Engine: Advanced password transformation rules (similar to Hashcat/John)
  • Multi-threaded: Efficient parallel processing
  • 📊 Progress Tracking: Real-time statistics and progress bars
  • 🎯 Multiple Input Formats: Hashcat format, Linux shadow files, plain hash files
  • 🔍 Auto-detection: Automatically detects hash types
  • 💾 Result Export: Save cracked passwords to file

Installation

Prerequisites

  • Go 1.21 or higher
  • libpcap development files (for PCAP parsing)
# On Ubuntu/Debian
sudo apt-get install libpcap-dev

# On macOS
brew install libpcap

# On Fedora/RHEL
sudo dnf install libpcap-devel

Build from Source

# Clone the repository
git clone https://github.com/gatiella/hashcrack.git
cd hashcrack

# Install dependencies
make deps

# Build
make build

# Install (optional)
sudo make install

Usage

Basic Hash Cracking

# Crack a single MD5 hash
./bin/hashcrack --hash 5f4dcc3b5aa765d61d8327deb882cf99 \
                --wordlist wordlist.txt \
                --hash-type md5

# Auto-detect hash type
./bin/hashcrack --hash 5f4dcc3b5aa765d61d8327deb882cf99 \
                --wordlist wordlist.txt

# Use built-in rules
./bin/hashcrack --hash 5f4dcc3b5aa765d61d8327deb882cf99 \
                --wordlist wordlist.txt \
                --use-rules

# Use custom rules file
./bin/hashcrack --hash <hash> \
                --wordlist wordlist.txt \
                --rules custom_rules.txt

# Specify number of workers
./bin/hashcrack --hash <hash> \
                --wordlist wordlist.txt \
                --workers 8

# Save results to file
./bin/hashcrack --hash <hash> \
                --wordlist wordlist.txt \
                --output results.txt

PCAP Analysis

# Analyze PCAP file
./bin/hashcrack analyze capture.pcap

# Extract and crack credentials from PCAP
./bin/hashcrack --input capture.pcap \
                --input-type pcap \
                --wordlist wordlist.txt

Hashcat Format Files

# Crack hashes from hashcat format file
./bin/hashcrack --input hashes.txt \
                --input-type hashcat \
                --wordlist wordlist.txt

Linux Shadow Files

# Crack passwords from /etc/shadow
./bin/hashcrack --input shadow.txt \
                --input-type shadow \
                --wordlist wordlist.txt

Rules Management

# List built-in rules
./bin/hashcrack rules list

# Test rules on a word
./bin/hashcrack rules test password

# Test with custom rules file
./bin/hashcrack rules test password --rules custom_rules.txt

Benchmarking

# Benchmark default hash type (MD5)
./bin/hashcrack benchmark

# Benchmark specific hash type
./bin/hashcrack benchmark --hash-type sha256

# Benchmark with specific worker count
./bin/hashcrack benchmark --hash-type md5 --workers 16

Supported Hash Types

Hash Type Identifier Example
MD5 md5 5f4dcc3b5aa765d61d8327deb882cf99
SHA1 sha1 5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8
SHA256 sha256 5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8
SHA512 sha512 b109f3bbbc244eb82441917ed06d618b9008dd09b3befd1b5e07394c706a8bb980b1d7785e5976ec049b46df5f1326af5a2ea6d103fd07c95385ffab0cacbc86
BCrypt bcrypt $2a$10$N9qo8uLOickgx2ZMRZoMyeIjZAgcfl7p92ldGxad68LJZdL17lhWy
NTLM ntlm 8846F7EAEE8FB117AD06BDD830B7586C

Rule Syntax

Rules use a syntax similar to Hashcat and John the Ripper:

Rule Description Example
: No change passwordpassword
l Lowercase all Passwordpassword
u Uppercase all passwordPASSWORD
c Capitalize passwordPassword
t Toggle case PasswordpASSWORD
r Reverse passworddrowssap
d Duplicate passpasspass
$X Append char X password + $1password1
^X Prepend char X password + ^11password
[ Delete first passwordassword
] Delete last passwordpasswor
L Leet speak passwordp4ssw0rd

Example Rules File

# rules.txt
:          # No change
c          # Capitalize
c$1        # Capitalize + append 1
c$!        # Capitalize + append !
c$1$2$3    # Capitalize + append 123
L          # Leet speak
c L        # Capitalize + leet speak
$2$0$2$4   # Append 2024

Performance Tips

  1. Optimize Workers: Set workers to match your CPU cores

    --workers $(nproc)
  2. Use Rules Efficiently: Rules multiply your wordlist size

    • Start with common rules
    • Use specific rules for targeted attacks
  3. Wordlist Optimization: Use sorted, cleaned wordlists

  4. Hash Type: Faster hashes (MD5, SHA1) are quicker to crack than slower hashes (BCrypt)

Project Structure

hashcrack/
├── cmd/hashcrack/          # Main application
├── internal/
│   ├── hasher/            # Hash implementations
│   ├── parser/            # File parsers
│   ├── rules/             # Rule engine
│   ├── wordlist/          # Wordlist handling
│   └── worker/            # Worker pool
├── pkg/capture/           # Credential extraction
├── configs/               # Configuration files
└── test/                  # Tests

Examples

Crack MD5 Hash

# Generate test hash
echo -n "password123" | md5sum
# Output: 482c811da5d5b4bc6d497ffa98491e38

# Crack it
./bin/hashcrack --hash 482c811da5d5b4bc6d497ffa98491e38 \
                --wordlist rockyou.txt \
                --use-rules \
                --workers 8 \
                --output found.txt

Extract from PCAP

# Capture credentials
./bin/hashcrack analyze traffic.pcap

# Output shows found credentials with protocols

Development

# Run tests
make test

# Run with coverage
make test-coverage

# Format code
make fmt

# Lint code
make lint

# Build for all platforms
make build-all

Contributing

Contributions are welcome! Please:

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests
  5. Submit a pull request

License

MIT License - see LICENSE file for details

Acknowledgments

  • Inspired by Hashcat and John the Ripper
  • Uses gopacket for PCAP parsing
  • Built with Cobra CLI framework

Support


Remember: Only use this tool on systems you own or have explicit permission to test!

About

A powerful, multi-threaded password cracking tool written in Go with support for multiple hash types, PCAP analysis, and custom transformation rules.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors