Skip to main content

A powerful directory scanning and hunting tool

Project description

DirHunter 🕵️‍♀️

DirHunter is a powerful, flexible directory scanning tool for web application security reconnaissance.

🚀 Features

  • Fast concurrent directory scanning
  • Customizable live printing
  • Advanced filtering
  • CLI and programmatic usage
  • Detailed scanning results
  • Supports various output formats

🛠 Installation

pip install dirhunter

💻 Usage

Command Line Interface

dirhunter --url https://example.com --file wordlist.txt

Advanced scanning options :

dirhunter --url https://example.com --file wordlist.txt --workers 20 --verbose

Programmatic Usage

1. Basic Scanning

from dirhunter import DirHunter

# Simple directory scanning
hunter = DirHunter('https://example.com')
directories = ['admin', 'login', 'dashboard']
results = hunter.scan_directories(directories)

# Print found directories
print("Found Directories:", hunter.found_directories)

2. Live Printing

from dirhunter import DirHunter
from colorama import Fore, Style

def custom_live_print(result):
    status_color = (
        Fore.GREEN if result['exists'] else 
        Fore.YELLOW if result.get('status_code') == 'Timeout' else 
        Fore.RED
    )
    
    print(f"{status_color}Checking: {result['url']} "
           f"[Status: {result['status_code']}]{Style.RESET_ALL}")

hunter = DirHunter('https://example.com').set_live_print(custom_live_print)
hunter.scan_directories(['admin', 'login', 'dashboard'])

3. Advanced Scanning with Filtering

from dirhunter import DirHunter
from dirhunter.utils import load_wordlist, filter_directories

# Load directories from a wordlist
directories = load_wordlist('large_wordlist.txt')

# Create hunter with custom configuration
hunter = DirHunter(
    'https://example.com', 
    max_workers=20,  # Increase concurrency
    timeout=3        # Adjust request timeout
)

# Scan and filter results
results = hunter.scan_directories(directories)
interesting_dirs = filter_directories(
    results, 
    status_codes=[200, 403, 301]  # Custom status code filtering
)

print("Interesting Directories:", interesting_dirs)

4. Custom Result Processing

from dirhunter import DirHunter

class AdvancedScanner:
    def __init__(self, base_url):
        self.hunter = DirHunter(base_url)
        self.results = []

    def scan(self, directories):
        def live_handler(result):
            if result['exists'] or result['status_code'] == 403:
                print(f"Potential Target: {result['url']}")
            self.results.append(result)

        self.hunter.set_live_print(live_handler)
        return self.hunter.scan_directories(directories)

    def get_summary(self):
        return {
            'total_scanned': len(self.results),
            'found_directories': [r['url'] for r in self.results if r['exists']]
        }

scanner = AdvancedScanner('https://example.com')
scanner.scan(['admin', 'login', 'dashboard'])
print(scanner.get_summary())

🔧 Configuration Options

  • base_url: Target website URL
  • max_workers: Number of concurrent scanning threads
  • timeout: Request timeout in seconds

🛡 Security Considerations

  • Always get permission before scanning websites
  • Respect robots.txt and website terms of service
  • Use responsibly and ethically

📝 License

MIT License

🐛 Reporting Issues

Report issues on the GitHub repository issues page.

🌟 Star the Project

If you find DirHunter useful, please give us a star on GitHub!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dirhunter-1.0.0.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

dirhunter-1.0.0-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file dirhunter-1.0.0.tar.gz.

File metadata

  • Download URL: dirhunter-1.0.0.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.2

File hashes

Hashes for dirhunter-1.0.0.tar.gz
Algorithm Hash digest
SHA256 54a07f7fb62a0e742af2cb700c49624d8adbe3a4c407fff761fb086d7ca50a9c
MD5 26e981334c0f57a03e031b1f01e53fb5
BLAKE2b-256 cd5b14c00515a4300fbbcb9cad90f89640238ae58cebec329231d27fb09f1704

See more details on using hashes here.

File details

Details for the file dirhunter-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: dirhunter-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 4.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.2

File hashes

Hashes for dirhunter-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3fcf330955147e5b4f5834cd82b69a8e84e2664b430bba9983836a0b44880efe
MD5 4751712e0c03dbfefad5bc9b7343cb0c
BLAKE2b-256 97f423e240c723aded9ffe4edd0b9c0c9ea2ba09eab529730e25f5a442fb6dba

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page