Automated Active Directory Penetration Testing Framework
ADBasher now includes a modern web interface for point-and-click penetration testing!
Quick Start:
cd web && chmod +x setup.sh && ./setup.sh
# Choose option 1 (Docker) for fastest setup
# Dashboard available at: http://localhost:3000Features:
- β¨ 4-step campaign creation wizard
- π Real-time attack monitoring with WebSocket updates
- π Live findings feed with auto-refresh
- π One-click report generation
- π³ Docker deployment ready
π Full Documentation: web/README.md | web/QUICKSTART.md
ADBasher is a comprehensive, unattended Active Directory penetration testing framework designed to automate the complete attack lifecycleβfrom initial reconnaissance to domain compromise. Built for professional security assessments, ADBasher orchestrates 27+ specialized modules across reconnaissance, credential attacks, post-exploitation, lateral movement, privilege escalation, and persistence phases.
- π€ Fully Automated Execution - Zero user interaction required after launch
- π Credential Cascading - Automatically escalates privileges when admin credentials are discovered
- πΎ Database-Driven - Persistent SQLite storage for all findings and session state
- π Professional Reporting - Generates both HTML and Markdown reports with executive summaries
- π‘οΈ Detection Evasion - Configurable OpSec modes (Standard/Stealth/Aggressive) with timing jitter
- π§ Modular Architecture - Easy to extend with new attack modules
- π Comprehensive Logging - Rich console output + JSON logs for SIEM integration
Reconnaissance β Credential Attacks β Post-Exploitation β Lateral Movement β Privilege Escalation β Persistence β Reporting
- Features
- Repository Structure
- Prerequisites
- Installation
- Quick Start
- Usage Guide
- Configuration
- Module Reference
- Testing
- Contributing
- Security & Legal
- Troubleshooting
- Documentation
- License
| Phase | Modules | Description |
|---|---|---|
| Reconnaissance | 5 modules | DNS discovery, LDAP enumeration, SMB null sessions, network scanning |
| Credential Attacks | 5 modules | Password spraying, Kerberoasting, AS-REP roasting, admin detection, DCSync checks |
| Post-Exploitation | 4 modules | BloodHound collection, secretsdump, LSASS dumping, DPAPI extraction |
| Lateral Movement | 1 module | Multi-method execution (WMI/PSExec/SMBExec/AtExec) |
| Privilege Escalation | 2 modules | Service misconfigurations, DLL hijacking, delegation abuse |
| Persistence | 3 modules | Golden/Silver tickets, ADCS abuse |
| Evasion | 4 modules | Timing jitter, AMSI bypass, MAC randomization, log cleanup |
| Reporting | 2 formats | HTML dashboards + Markdown reports |
- Smart Dependencies - Modules only execute when prerequisites are met
- Lockout Protection - Intelligent throttling prevents account lockouts
- Graceful Degradation - Continues execution even if individual modules fail
- Session Management - All artifacts stored in timestamped session directories
- Progress Tracking - Real-time Rich console output with colored status updates
ADBasher/
βββ adbasher.py # Main CLI entry point
βββ core/ # Framework core
β βββ orchestrator.py # Attack phase orchestration
β βββ database.py # SQLite ORM (Targets, Credentials, Vulns)
β βββ logger.py # Rich console + JSON logging
β βββ config.yaml # Global configuration
β
βββ 1 nocreds/ # Reconnaissance (no credentials)
β βββ discover_domain.py # DNS SRV record enumeration
β βββ ldap_anonymous_bind.py # LDAP anonymous user enumeration
β βββ smb_null_enum.py # SMB null session enumeration
β βββ adnetscan_db.py # Network scanning wrapper
β
βββ 3 nopass/automated/ # Credential attacks (valid usernames)
β βββ password_spray.py # Lockout-protected password spraying
β βββ kerberoast.py # TGS ticket extraction
β βββ asreproast.py # AS-REP roasting (pre-auth disabled)
β
βββ 6 validcreds/automated/ # Post-exploitation (valid credentials)
β βββ check_admin.py # Admin privilege detection
β βββ bloodhound_collect.py # BloodHound data collection
β βββ secretsdump_auto.py # NTDS.dit dumping
β βββ lsass_dump.py # LSASS memory dumping
β βββ dcsync_check.py # DCSync rights detection
β βββ dpapi_extract.py # DPAPI masterkey extraction
β βββ lateral_movement.py # Multi-method lateral movement
β
βββ 7 privesc/automated/ # Privilege escalation
β βββ privesc_scanner.py # Service/delegation/registry checks
β βββ dll_hijacking.py # DLL hijacking opportunity scanner
β
βββ 8 persistence/automated/ # Persistence mechanisms
β βββ golden_ticket.py # Golden Ticket generation
β βββ silver_ticket.py # Silver Ticket generation
β βββ adcs_abuse.py # Certificate Services exploitation
β
βββ evasion/ # Detection evasion
β βββ timing.py # Jitter delays & business hours
β βββ amsi_bypass.py # PowerShell AMSI bypass
β βββ mac_randomization.py # MAC address randomization
β βββ log_cleanup.py # Windows Event Log cleanup
β
βββ reporting/ # Report generation
β βββ html_report.py # Professional HTML report generator
β
βββ tests/ # Test suite
β βββ test_core.py # Unit tests (database, logger)
β βββ test_integration.py # Integration tests (mock AD)
β βββ validate_syntax.py # Python syntax validator
β βββ verify_database.py # Database integrity checker
β
βββ docs/ # Documentation
β βββ TESTING.md # Testing guide & lab setup
β βββ PERFORMANCE.md # Optimization guide
β βββ VALIDATION_REPORT.md # Test results & validation
β
βββ resources/ # Reference materials
βββ pentest_ad_dark_2022_11.svg # AD attack map
- OS: Kali Linux 2024.x, Parrot OS, or Ubuntu 22.04+
- Python: 3.10 or higher
- Privileges: Root/sudo access (for some modules)
- Network: Direct access to target AD environment
The framework integrates with these external tools (must be installed):
# Install system packages
sudo apt update
sudo apt install -y crackmapexec impacket-scripts enum4linux-ng
# Optional but recommended
sudo apt install -y bloodhound
pip3 install certipy-adAll Python dependencies are managed via requirements.txt:
sqlalchemy- Database ORMpyyaml- Configuration parsingrich- Terminal output formattingdnspython- DNS queriesldap3- LDAP operations
# Clone repository
git clone https://github.com/yourusername/ADBasher.git
cd ADBasher
# Run automated installer
sudo ./install.sh
# Verify installation
./adbasher.py --help# Clone repository
git clone --recurse-submodules https://github.com/yourusername/ADBasher.git
cd ADBasher
# Install system dependencies
sudo apt update
sudo apt install -y python3-pip crackmapexec impacket-scripts
# Install Python dependencies
pip3 install -r requirements.txt
# Make executable
chmod +x adbasher.py
chmod +x -R "1 nocreds/" "3 nopass/" "6 validcreds/" "7 privesc/" "8 persistence/"
# Test installation
python3 -c "from core import database, logger, orchestrator; print('β Core modules OK')"# Validate all Python modules
python3 tests/validate_syntax.py
# Run unit tests
python3 tests/test_integration.py
# Check tool availability
which crackmapexec secretsdump.py GetUserSPNs.py# Target a single domain
./adbasher.py --target example.local
# Target multiple domains/networks
./adbasher.py --target example.local corp.local 192.168.1.0/24
# Use stealth mode (slower but safer)
./adbasher.py --target example.local --opsec stealth[14:30:15] ADBasher v1.0 - Automated AD Pentesting Framework
[14:30:15] Session ID: abc12345
[14:30:15] Target: example.local
[14:30:15] OpSec Mode: standard
[Phase 1] Reconnaissance
-> DNS Discovery: example.local
β Found DC: DC01.example.local (192.168.1.10)
-> LDAP Anonymous Bind: 192.168.1.10
β Enumerated: 250 users
[Phase 2] Credential Attacks
-> AS-REP Roast: example.local
β Found 2 vulnerable accounts
-> Password Spray: 250 users Γ 7 passwords
β Valid: EXAMPLE\jdoe:Password123
[Phase 3] Admin Detection
-> Checking privileges: jdoe
β Admin access confirmed!
[Phase 4] Post-Exploitation (AUTO-TRIGGERED)
-> BloodHound Collection
β Saved: bloodhound_data/20241212_example.zip
-> Secretsdump: DC01
β Extracted 250 NTLM hashes
[Phase 5] Lateral Movement
-> WMIExec: 25 targets
β Success: 12/25 hosts
[Phase 6] Reporting
β Report: ~/.adbasher/sessions/abc12345/report.html
β Report: ~/.adbasher/sessions/abc12345/report.md
[14:45:30] Framework execution complete
[14:45:30] Session artifacts: ~/.adbasher/sessions/abc12345/
./adbasher.py [OPTIONS]
Required:
--target DOMAIN/IP Target domain(s) or CIDR ranges (space-separated)
Optional:
--opsec MODE OpSec mode: standard|stealth|aggressive (default: standard)
--session-id ID Resume existing session
--skip-phases PHASES Skip specific phases (comma-separated)
--help Show help message
Examples:
./adbasher.py --target example.local
./adbasher.py --target 10.0.0.0/24 example.local --opsec stealth
./adbasher.py --target corp.local --skip-phases recon,persistenceEdit core/config.yaml for advanced settings:
global:
session_dir: ~/.adbasher/sessions
log_level: INFO
scope:
target_domains:
- "example.local"
exclude_ips:
- "192.168.1.1" # Gateway
evasion:
mode: "standard" # standard | stealth | aggressive
jitter_min: 5 # Minimum delay (seconds)
jitter_max: 30 # Maximum delay (seconds)
work_hours_only: false # Only operate 9 AM - 5 PM# View session artifacts
ls ~/.adbasher/sessions/<SESSION_ID>/
# Key files:
# - session.db SQLite database
# - session_*.log Human-readable logs
# - session_*.json.log SIEM-ready JSON logs
# - report.html Interactive HTML report
# - report.md Markdown report
# - bloodhound_data/ BloodHound ZIP files# Open session database
sqlite3 ~/.adbasher/sessions/<SESSION_ID>/session.db
# Example queries:
SELECT * FROM targets WHERE is_dc=1;
SELECT username, password FROM credentials WHERE is_admin=1;
SELECT name, severity FROM vulnerabilities;| Module | Purpose | Credentials Required |
|---|---|---|
discover_domain.py |
DNS SRV record enumeration to find DCs | No |
ldap_anonymous_bind.py |
LDAP anonymous enumeration for users | No |
smb_null_enum.py |
SMB null session enumeration | No |
adnetscan_db.py |
Network scanning (wraps ADnetscan.sh) | No |
| Module | Purpose | Credentials Required |
|---|---|---|
password_spray.py |
Lockout-protected password spraying | Usernames only |
kerberoast.py |
TGS ticket extraction for offline cracking | Valid domain user |
asreproast.py |
AS-REP roasting (pre-auth disabled accounts) | No |
check_admin.py |
Tests credentials for admin privileges | Valid credentials |
dcsync_check.py |
Detects DCSync rights | Valid credentials |
| Module | Purpose | Credentials Required |
|---|---|---|
bloodhound_collect.py |
BloodHound data collection | Valid domain user |
secretsdump_auto.py |
NTDS.dit dumping | Domain Admin |
lsass_dump.py |
LSASS memory dumping | Local Admin |
dpapi_extract.py |
DPAPI masterkey extraction | Valid user |
See docs/ directory for detailed module documentation.
# Run all tests
cd ADBasher
# 1. Syntax validation (107 Python files)
python3 tests/validate_syntax.py
# 2. Unit tests (database, logger, config)
python3 tests/test_core.py
# 3. Integration tests (mock AD environment)
python3 tests/test_integration.py
# 4. Database integrity check (after running framework)
python3 tests/verify_database.py ~/.adbasher/sessions/<SESSION_ID>/session.dbFor comprehensive testing, deploy a lab Active Directory environment:
# See detailed lab setup guide
cat docs/TESTING.md
# Recommended: GOAD (Game of Active Directory)
# Or DetectionLab for testing with logging/monitoringTest Coverage: 85% automated, 95% with manual lab testing
We welcome contributions! Please follow these guidelines:
# Fork and clone
git clone https://github.com/yourusername/ADBasher.git
cd ADBasher
# Create feature branch
git checkout -b feature/your-feature-name
# Install development dependencies
pip3 install -r requirements-dev.txt # (if available)- Create module file: Place in appropriate phase directory (
1 nocreds/,3 nopass/, etc.) - Follow template: Use existing modules as reference
- Database integration: Use
DatabaseManagerfor persistence - Logging: Import and use framework logger
- CLI arguments: Use argparse with
--session-dirparameter - Test: Add unit tests to
tests/test_core.py
Example module template:
#!/usr/bin/env python3
import sys
import os
import argparse
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '../..')))
from core.database import DatabaseManager
from core.logger import setup_logger, get_logger
logger = None
def your_module_function(session_dir, target, **kwargs):
global logger
setup_logger("your_module", session_dir)
logger = get_logger("your_module")
db_path = os.path.join(session_dir, "session.db")
db = DatabaseManager(db_path)
# Your attack logic here
logger.info(f"Starting attack against {target}")
# Store results
db.add_target(ip=target, hostname="example")
logger.info("Attack complete")
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("--session-dir", required=True)
parser.add_argument("--target", required=True)
args = parser.parse_args()
your_module_function(args.session_dir, args.target)- Python: PEP 8 compliant
- Docstrings: Google-style docstrings for all functions
- Type hints: Use where applicable
- Error handling: Try-except blocks with proper logging
- Testing: Add tests for new functionality
- Update documentation (README.md, module docstrings)
- Run automated tests:
python3 tests/validate_syntax.py - Test in lab environment
- Submit PR with clear description of changes
This tool performs ACTIVE ATTACKS against systems.
- β ONLY use on systems you own or have written authorization to test
- β Obtain signed scope agreements before engagements
- β Follow local laws and industry regulations (GDPR, HIPAA, PCI-DSS)
- β Unauthorized access is a CRIME in most jurisdictions
- Penetration Testing: Authorized security assessments only
- Red Team Exercises: With proper client authorization
- Security Research: In isolated lab environments
- Education: Personal learning in controlled environments
The authors and contributors are not responsible for misuse of this tool. Users are solely responsible for ensuring they have proper authorization before using ADBasher.
# Solution: Set PYTHONPATH
export PYTHONPATH=/path/to/ADBasher:$PYTHONPATH
./adbasher.py --target example.local
# Or use absolute path
python3 /full/path/to/adbasher.py --target example.local# Solution: Make scripts executable
chmod +x adbasher.py
chmod +x -R "1 nocreds/" "3 nopass/" "6 validcreds/"# Solution: Kill lingering processes
pkill -f adbasher
rm ~/.adbasher/sessions/*/session.db-journal # if exists# Solution: Install missing tools
sudo apt install crackmapexec impacket-scripts
pip3 install bloodhound certipy-ad# Enable verbose logging
# Edit core/config.yaml:
global:
log_level: DEBUG # Change from INFO
# Then run normally
./adbasher.py --target example.local- Check documentation:
docs/directory - Search issues: GitHub Issues tab
- Review logs:
~/.adbasher/sessions/<SESSION_ID>/session_*.log - Submit bug report: Include logs and error messages
| Document | Description |
|---|---|
| TESTING.md | Lab setup, test procedures, validation |
| PERFORMANCE.md | Optimization guide, profiling, benchmarks |
| VALIDATION_REPORT.md | Test results, coverage metrics |
| Walkthrough | Step-by-step execution example |
- Orange Cyberdefense AD Mind Map
- MITRE ATT&CK - Active Directory
- BloodHound Documentation
- Impacket Examples
- Total Modules: 27 Python modules
- Lines of Code: ~9,000+
- Test Coverage: 85%
- Supported Tools: 10+ (Impacket, CrackMapExec, BloodHound, etc.)
- Attack Techniques: 40+
- Python Files: 107 (including dependencies)
- Multi-threading for parallel scanning
- Automated hash cracking (Hashcat integration)
- Neo4j integration for BloodHound analysis
- Web dashboard (Flask)
- Azure AD enumeration support
- C2 integration (Cobalt Strike, Metasploit)
- Docker containerization
- Distributed scanning
- AI-powered attack path selection
- MITRE ATT&CK mapping
This project is licensed under the MIT License - see the LICENSE file for details.
- Project Lead: [Your Name]
- Contributors: See CONTRIBUTORS.md
- Orange Cyberdefense - AD penetration testing methodology
- BloodHound Team - Attack path enumeration inspiration
- Impacket Developers - Protocol implementations
- Open Source Community - Tool integrations and libraries
- GitHub Issues: Report bugs or request features
- Discussions: Ask questions
- Email: [email protected] (for security disclosures)
If you find ADBasher useful, please consider starring the repository! β
Made with β€οΈ by security professionals, for security professionals
Documentation β’ Contributing β’ License β’ Changelog