Skip to content

About

No description, website, or topics provided.

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Brain Wallet Scanner

Academic security research tool demonstrating brain wallet vulnerabilities on Bitcoin testnet.

⚠️ WARNING

  • Testnet only - Never use on mainnet
  • Educational purpose - For academic research only
  • No real funds - Demonstrates vulnerabilities without theft
  • Multiple safety controls - Mainnet operations blocked at every level

What is a Brain Wallet?

A brain wallet is a Bitcoin wallet where the private key is derived directly from a passphrase using:

private_key = SHA256(passphrase)

This makes them:

  • βœ… Easy to remember (just memorize a phrase)
  • ❌ Extremely insecure (attackable by anyone with a wordlist)

This tool demonstrates how vulnerable brain wallets are by scanning for them on Bitcoin testnet.

Project Structure

brain-wallet-scanner/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ password_generator.py      # Component 1: Password generation
β”‚   β”œβ”€β”€ address_generator.py       # Component 2: Address derivation
β”‚   β”œβ”€β”€ blockchain_checker.py      # Component 3: Blockchain scanning
β”‚   β”œβ”€β”€ logger.py                  # Component 5: Logging & reporting
β”‚   └── main.py                    # Main orchestrator
β”œβ”€β”€ tests/                         # Unit and integration tests
β”œβ”€β”€ config/                        # Configuration files
β”œβ”€β”€ data/
β”‚   └── wordlists/                 # Password dictionaries (download separately)
β”œβ”€β”€ logs/                          # Execution logs
β”œβ”€β”€ results/                       # Scan reports (JSON)
└── requirements.txt               # Python dependencies

Setup

1. Install Python Dependencies

pip install -r requirements.txt

2. Download Wordlist (Optional)

For dictionary-based scanning, download the RockYou password list:

# Create directory
mkdir -p data/wordlists

# Download RockYou wordlist
# Option 1: From SecLists repository
cd data/wordlists
curl -LO https://github.com/danielmiessler/SecLists/raw/master/Passwords/Leaked-Databases/rockyou.txt.tar.gz
tar -xzf rockyou.txt.tar.gz

# Option 2: Download from Kaggle or other source
# See data/wordlists/README.md for alternative sources

3. Configure

The default configuration works out of the box. To customize:

cp config/config.example.yaml config/config.yaml
# Edit config.yaml if needed

Usage

Basic Scan (Bitcoin-specific passwords)

cd src
python main.py --passwords 5000 --strategy bitcoin_specific

This will test 5,000 cryptocurrency-themed passwords like "bitcoin2024", "satoshi123", etc.

Dictionary-Based Scan

python main.py --passwords 10000 --strategy dictionary --wordlist ../data/wordlists/rockyou.txt

Pattern-Based Scan

python main.py --passwords 5000 --strategy patterns

Hybrid Scan (All Strategies)

python main.py --passwords 20000 --strategy hybrid

Command-Line Options

Options:
  --config PATH            Path to config file (default: config/config.yaml)
  --passwords N            Number of passwords to try (default: 10000)
  --strategy STRATEGY      Password strategy (default: bitcoin_specific)
                          Choices: dictionary, patterns, bitcoin_specific, hybrid
  --wordlist PATH         Override wordlist path from config

Examples

# Quick test with 1,000 passwords
python main.py --passwords 1000 --strategy bitcoin_specific

# Full scan with 50,000 passwords (takes several hours)
python main.py --passwords 50000 --strategy hybrid

# Dictionary scan with custom wordlist
python main.py --passwords 100000 --strategy dictionary --wordlist /path/to/wordlist.txt

Output

Logs

Detailed logs are saved to ./logs/scan_YYYYMMDD_HHMMSS.log

Example log output:

INFO: Progress: 1,000 passwords tried
WARNING: 🎯 VULNERABLE BRAIN WALLET FOUND #1
WARNING:    Address: mohjSavDdQYHRYXcS3uS6ttaHP8amyvX78
WARNING:    Balance: 50000 satoshis
WARNING:    Transactions: 3

Results

JSON reports are saved to ./results/scan_report_YYYYMMDD_HHMMSS.json

Example report structure:

{
  "summary": {
    "passwords_tried": 10000,
    "addresses_checked": 10000,
    "vulnerable_addresses_found": 12,
    "duration_seconds": 7234.5
  },
  "performance": {
    "passwords_per_second": 1.38,
    "addresses_per_second": 1.38
  },
  "vulnerable_addresses": [
    {
      "address": "mohjSavDdQYHRYXcS3uS6ttaHP8amyvX78",
      "balance": 50000,
      "tx_count": 3,
      "discovery_time": "2024-10-19T14:23:45"
    }
  ],
  "success_criteria": {
    "target_vulnerables": 10,
    "found_vulnerables": 12,
    "criteria_met": true
  }
}

Testing

Run unit tests:

cd tests
pytest -v

Run with coverage:

pytest --cov=../src --cov-report=html

Run integration tests (requires internet):

pytest -v -m integration

Performance

Expected performance:

  • Password generation: 10,000+ per second (dictionary mode)
  • Address derivation: 1,000+ per second (pure Python)
  • Blockchain checking: 10-100 per second (API rate limited)
  • Memory usage: < 1GB RAM

Success Criteria

The tool is considered successful if it finds β‰₯10 vulnerable brain wallet addresses on testnet.

This demonstrates that:

  1. Brain wallets are actively used (or were used)
  2. They can be cracked with simple dictionary attacks
  3. Implementation flaws (weak passphrases) break Bitcoin security today

Safety Controls

This tool has multiple layers of safety enforcement:

1. Configuration Validation

if config['bitcoin_network'] != 'testnet':
    raise ValueError("MAINNET BLOCKED")

2. Address Format Validation

if not address.startswith(('m', 'n', 'tb1')):
    raise ValueError("NOT A TESTNET ADDRESS")

3. Generator Initialization

def __init__(self, testnet: bool = True):
    if not testnet:
        raise ValueError("MAINNET GENERATION BLOCKED")

4. Blockchain API Endpoints

# Hardcoded testnet endpoints
self.base_url = "https://blockstream.info/testnet/api"

Mainnet operations are impossible - the tool will crash before executing any mainnet operation.

Architecture

The scanner consists of 5 core components:

  1. Password Generator - Generates candidate passphrases using:

    • Dictionary attacks (RockYou, etc.)
    • Pattern-based generation (word+year, word+123)
    • Bitcoin-specific phrases ("satoshi2009", "hodlbitcoin")
    • AI generation (optional, Phase 4B)
  2. Address Generator - Converts passphrases to Bitcoin addresses:

    • private_key = SHA256(passphrase)
    • ECDSA secp256k1 public key generation
    • Bitcoin address derivation (P2PKH)
    • Testnet-only enforcement
  3. Blockchain Checker - Scans Bitcoin testnet blockchain:

    • Blockstream.info API (recommended)
    • BlockCypher API (alternative)
    • Detects transaction history
    • Rate limiting & caching
  4. Fund Sweeper - (Optional, not implemented in Phase 4A)

    • Would transfer found funds to research wallet
    • Not needed for academic demonstration
  5. Logger & Reporter - Comprehensive logging:

    • Real-time progress tracking
    • Detailed evidence collection
    • JSON report generation
    • Statistics tracking

Academic Context

This tool is part of a research project demonstrating that:

Implementation flaws (not quantum computers) are breaking Bitcoin TODAY.

Key insights:

  • Brain wallets are fundamentally insecure
  • Dictionary attacks work on real-world passphrases
  • Users choose predictable passwords
  • This is a current, exploitable vulnerability

Ethical Considerations

  • βœ… Testnet only - No real funds at risk
  • βœ… Educational purpose - Demonstrates security flaws
  • βœ… Open source - Transparent research methodology
  • βœ… Safety controls - Multiple mainnet prevention layers

Future Enhancements (Phase 4B)

Potential improvements:

  • AI-based password generation (GPT-2/DistilGPT-2)
  • Multi-threading for parallel address generation
  • GPU acceleration for address derivation
  • Support for P2SH and Bech32 addresses
  • Fund sweeping functionality (testnet only)
  • Web dashboard for real-time monitoring

Troubleshooting

"Wordlist file not found"

Download RockYou or other wordlist to data/wordlists/

"Rate limit exceeded"

Reduce [REDACTED_PRIVATE_KEY] in config or add delays between requests

"API timeout"

Check internet connection and API status:

"Found 0 vulnerable addresses"

This is expected if scanning random passwords. Try:

  • Increase password count
  • Use Bitcoin-specific strategy
  • Try different wordlists

References

License

MIT License - For academic research only

Authors

Security Research Team - Phase 4A Implementation

Disclaimer

This tool is for educational and research purposes only. Do not use brain wallets for real funds. The authors are not responsible for any misuse of this software.


Remember: Brain wallets are insecure. Never use them with real Bitcoin.

About

No description, website, or topics provided.

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages