Skip to content

threatcode/hunter

AI Bug Hunter Framework

πŸ” An AI-assisted bug-hunting framework that automates high-volume reconnaissance, surfaces high-probability attack paths, runs smart dynamic checks, and produces prioritized findings with reproducible PoCs and recommended mitigations.

πŸš€ Quick Start

Prerequisites

  • Python 3.8+
  • PostgreSQL 12+
  • Redis 6+
  • Git

Installation

  1. Clone the repository:
git clone <repository-url>
cd hunter
  1. Set up environment:
# Create virtual environment
python3 -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt

# Install Playwright browsers
playwright install chromium
  1. Configure environment:
# Copy example environment file
cp .env.example .env

# Edit .env with your configuration
nano .env
  1. Initialize database:
python3 scripts/init_db.py
  1. Start services:
./scripts/start_services.sh
  1. Access the application:

πŸ“‹ Configuration

Environment Variables

Create a .env file with the following configuration:

# Database Configuration
DATABASE_URL=postgresql://postgres:password@localhost:5432/bug_hunter

# Redis Configuration
REDIS_URL=redis://localhost:6379/0
CELERY_BROKER_URL=redis://localhost:6379/0
CELERY_RESULT_BACKEND=redis://localhost:6379/0

# API Keys (optional but recommended)
SHODAN_API_KEY=your_shodan_api_key_here
VIRUSTOTAL_API_KEY=your_virustotal_api_key_here
SECURITYTRAILS_API_KEY=your_securitytrails_api_key_here
GITHUB_TOKEN=your_github_token_here
CENSYS_API_KEY=your_censys_api_key_here

# OpenAI Configuration (for AI features)
OPENAI_API_KEY=your_openai_api_key_here

# Evidence Storage
EVIDENCE_STORAGE_TYPE=local  # or 's3'
EVIDENCE_BASE_PATH=evidence

# Security
API_ENCRYPTION_KEY=generate_with_fernet.generate_key()

API Keys Setup

The framework supports multiple external services for enhanced reconnaissance:

  • Shodan: Host and service discovery
  • VirusTotal: Passive DNS and malware analysis
  • SecurityTrails: Historical DNS data
  • GitHub: Code repository scanning
  • Censys: Internet-wide scanning data
  • OpenAI: AI-powered analysis and PoC generation

πŸ—οΈ Architecture

Core Components

hunter/
β”œβ”€β”€ automation/          # Orchestration and core services
β”‚   β”œβ”€β”€ orchestrator.py  # Job scheduling and workflow management
β”‚   β”œβ”€β”€ database.py      # Database models and repositories
β”‚   β”œβ”€β”€ api_manager.py   # API key management and rate limiting
β”‚   β”œβ”€β”€ ai_services.py   # LLM and embedding services
β”‚   └── logging_config.py # Audit logging and evidence storage
β”œβ”€β”€ recon/              # Reconnaissance modules
β”‚   β”œβ”€β”€ collectors.py   # Data collection from various sources
β”‚   └── tasks.py        # Celery tasks for distributed recon
β”œβ”€β”€ analysis/           # Content discovery and app analysis
β”‚   └── tasks.py        # Web application analysis tasks
β”œβ”€β”€ fuzz/               # Vulnerability scanning and fuzzing
β”‚   └── tasks.py        # Automated vulnerability detection
β”œβ”€β”€ ui/                 # Web interface
β”‚   └── api.py          # FastAPI REST API
β”œβ”€β”€ data/               # Data models and schemas
β”‚   └── schemas.py      # Pydantic models for all entities
β”œβ”€β”€ docs/               # Documentation
β”‚   └── legal-ethics-policy.md # Legal and ethical guidelines
└── scripts/            # Utility scripts
    β”œβ”€β”€ init_db.py      # Database initialization
    β”œβ”€β”€ start_services.sh # Service startup script
    └── stop_services.sh  # Service shutdown script

Data Flow

  1. Job Submission β†’ API receives scan requests
  2. Task Distribution β†’ Celery distributes work to workers
  3. Data Collection β†’ Collectors gather information from various sources
  4. Analysis β†’ AI services analyze findings and generate insights
  5. Storage β†’ Results stored in PostgreSQL with evidence in file system
  6. Reporting β†’ Dashboard and API provide access to findings

πŸ”§ Usage

Starting a Reconnaissance Scan

# Using curl
curl -X POST "http://localhost:8000/scans" \
  -H "Content-Type: application/json" \
  -d '{
    "target": "example.com",
    "scan_type": "recon",
    "priority": 8
  }'

Running a Full Workflow

# Start comprehensive reconnaissance
curl -X POST "http://localhost:8000/workflows/recon?target=example.com"

# Start vulnerability assessment
curl -X POST "http://localhost:8000/workflows/vulnerability-assessment?target=example.com"

Viewing Results

# List all scans
curl "http://localhost:8000/scans"

# Get scan status
curl "http://localhost:8000/scans/{job_id}"

# List findings
curl "http://localhost:8000/findings"

# Get dashboard statistics
curl "http://localhost:8000/dashboard/stats"

πŸ›‘οΈ Security & Ethics

Legal Compliance

⚠️ IMPORTANT: This framework is designed for authorized security testing only. Before using:

  1. Read the Legal & Ethics Policy
  2. Obtain written authorization for all targets
  3. Respect scope limitations and out-of-scope rules
  4. Follow responsible disclosure practices

Safe Usage Guidelines

  • βœ… Only test systems you own or have explicit permission to test
  • βœ… Implement reasonable rate limiting to avoid service disruption
  • βœ… Document all activities for audit purposes
  • βœ… Report findings responsibly to appropriate parties
  • ❌ Never test without authorization
  • ❌ Never access or modify sensitive data
  • ❌ Never perform destructive actions

πŸ” Features

Reconnaissance Capabilities

  • Certificate Transparency Logs - Subdomain discovery via CT logs
  • Passive DNS - Historical DNS data analysis
  • Shodan Integration - Internet-wide host discovery
  • GitHub Dorking - Code repository scanning
  • Wayback Machine - Historical content analysis
  • Technology Fingerprinting - Framework and service identification

Vulnerability Detection

  • SQL Injection - Automated SQLi detection with error-based analysis
  • Cross-Site Scripting (XSS) - Reflected and stored XSS detection
  • Server-Side Request Forgery (SSRF) - Internal service probing
  • Directory Traversal - File inclusion vulnerability testing
  • Information Disclosure - Sensitive file and configuration exposure
  • Security Misconfigurations - Missing security headers and controls

AI-Powered Analysis

  • Intelligent Triage - AI-assisted finding prioritization
  • PoC Generation - Automated proof-of-concept creation
  • Vulnerability Analysis - LLM-powered security assessment
  • Report Summarization - Natural language finding summaries

Evidence Management

  • Screenshot Capture - Automated web application screenshots
  • Request/Response Logging - Complete HTTP transaction recording
  • Audit Trail - Immutable activity logging
  • Evidence Storage - Secure file storage with integrity verification

πŸ“Š Dashboard & Reporting

Web Interface Features

  • Real-time Scan Monitoring - Live status updates
  • Finding Management - Triage, assignment, and tracking
  • Asset Inventory - Comprehensive asset discovery view
  • Evidence Viewer - Integrated evidence examination
  • Export Capabilities - PDF and JSON report generation

API Endpoints

  • GET /health - System health check
  • POST /scans - Submit new scan job
  • GET /scans/{id} - Get scan status
  • GET /findings - List security findings
  • POST /findings/{id}/triage - Triage findings
  • GET /assets - List discovered assets
  • GET /dashboard/stats - System statistics

πŸ”§ Development

Running in Development Mode

# Start individual components
redis-server
celery -A automation.orchestrator worker --loglevel=info
python3 -m uvicorn ui.api:app --reload --host 0.0.0.0 --port 8000

Testing

# Run tests
pytest

# Run with coverage
pytest --cov=. --cov-report=html

Adding New Collectors

  1. Create collector class in recon/collectors.py
  2. Implement collect() method
  3. Add to ReconOrchestrator
  4. Create corresponding Celery task in recon/tasks.py

Database Migrations

# Reset database (WARNING: deletes all data)
python3 scripts/init_db.py --reset

# Check database connection
python3 scripts/init_db.py --check

🚦 Service Management

Starting Services

./scripts/start_services.sh

Stopping Services

./scripts/stop_services.sh

Service Status

# Check individual services
redis-cli ping
celery -A automation.orchestrator inspect ping
curl http://localhost:8000/health

πŸ“š Documentation

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Development Guidelines

  • Follow PEP 8 style guidelines
  • Add comprehensive docstrings
  • Include unit tests for new features
  • Update documentation as needed
  • Ensure legal and ethical compliance

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

⚠️ Disclaimer

This tool is intended for authorized security testing and educational purposes only. Users are responsible for ensuring they have proper authorization before testing any systems. The developers assume no liability for misuse of this software.

πŸ†˜ Support


Happy Bug Hunting! πŸ›πŸ”

About

No description, website, or topics provided.

Resources

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages