bloodhound-cli
bloodhound-cli is a Python command-line tool designed to query and manage data from BloodHound with support for both Legacy (Neo4j) and Community Edition (CE) backends.
🏗️ Modular Architecture
The CLI now features a clean, modular architecture that eliminates code duplication and follows best practices:
src/bloodhound_cli/
├── core/
│ ├── base.py # Abstract base class with common interface
│ ├── legacy.py # Neo4j implementation
│ ├── ce.py # HTTP API implementation
│ └── factory.py # Factory pattern for client creation
├── main.py # CLI entry point
└── tests/ # Comprehensive test suite
✨ Key Features
🔄 Dual Backend Support
- Legacy (Neo4j): Full feature set with direct Neo4j queries
- Community Edition (CE): HTTP API integration with BloodHound CE
🎯 Unified Interface
- Same commands work with both backends
- Automatic client selection based on
--editionflag - No code duplication - queries centralized in base classes
🧪 Comprehensive Testing
- Unit tests with mocks for isolated testing
- Integration tests with real BloodHound CE and GOAD data
- Docker-based test environment with realistic data
🔧 Advanced Query Support
- User enumeration with domain filtering
- Computer enumeration with LAPS filtering
- Admin and high-value user detection
- Password policy analysis
- Session and access path queries
🚀 Installation
The CLI and development tooling require Python 3.9 or newer.
Recommended: pipx (isolated environment)
pipx install bloodhound-cli
Alternative: pip
pip install bloodhound-cli
Development: from source
git clone https://github.com/ADScanPro/bloodhound-cli.git
cd bloodhound-cli
uv pip install -e .[dev]
The
.[dev]extra installs linting and testing tooling (ruff,pylint,pytest). Useuvfor all dependency management to keep environments reproducible. Version control the generateduv.lockso anyone cloning the repo can runuv pip syncand get the exact same dependency set.
📖 Usage
Basic Commands
List Users
# Legacy (Neo4j)
bloodhound-cli --edition legacy user -d mydomain.local
# Community Edition (CE)
bloodhound-cli --edition ce user -d mydomain.local
Show Version
bloodhound-cli version
# or
bloodhound-cli --version
List Group Memberships For A User
# Resolve recursive memberships (default)
bloodhound-cli --edition ce group -d mydomain.local -u alice
# Only direct memberships
bloodhound-cli group -d mydomain.local -u alice --direct-only
List Computers
# All computers
bloodhound-cli --edition ce computer -d mydomain.local
# Filter by LAPS
bloodhound-cli --edition ce computer -d mydomain.local --laps true
Admin Users
bloodhound-cli --edition ce admin -d mydomain.local
High Value Users
bloodhound-cli --edition ce highvalue -d mydomain.local
Connection Configuration
Legacy (Neo4j)
bloodhound-cli --edition legacy user -d mydomain.local \
--uri bolt://localhost:7687 \
--user neo4j \
--password mypassword
Community Edition (CE)
bloodhound-cli --edition ce user -d mydomain.local \
--base-url http://localhost:8080 \
--username admin \
--ce-password Bloodhound123!
Debug and Verbose Output
bloodhound-cli --edition ce --debug --verbose user -d mydomain.local
🧪 Testing
Unit Tests
pytest tests/unit/ -v
Integration Tests
# Requires BloodHound CE running
pytest tests/integration/ -v
Full Test Suite with GOAD Data
# Setup test environment with GOAD data
./scripts/setup-complete.sh
./scripts/test-with-goad-domains.sh
🏛️ Architecture Benefits
✅ No Code Duplication
- Queries defined once in base classes
- Legacy and CE implementations inherit common interface
- Changes propagate automatically to both backends
✅ Easy Extension
- Add new queries by implementing abstract methods
- Factory pattern handles client creation
- Clean separation of concerns
✅ Comprehensive Testing
- Unit tests with mocks for fast feedback
- Integration tests with real data
- Docker-based test environment
✅ Maintainable Code
- Clear separation between CLI, core logic, and implementations
- Type hints and documentation
- Follows Python best practices
🔧 Development
Project Structure
bloodhound-cli/
├── src/bloodhound_cli/
│ ├── core/ # Core business logic
│ ├── main.py # CLI entry point
│ └── __init__.py
├── tests/ # Test suite
├── scripts/ # Automation scripts
└── test-data/ # Test data (GOAD)
Adding New Queries
- Add method to
BloodHoundClientbase class - Implement in both
BloodHoundLegacyClientandBloodHoundCEClient - Add CLI command in
main.py - Create tests in
tests/
Testing Strategy
- Unit Tests: Mock external dependencies
- Integration Tests: Real BloodHound CE with GOAD data
- CI/CD: Automated testing with Docker
📊 Supported Domains (GOAD Test Data)
The project includes comprehensive test data from GOAD (Game of Active Directory):
- north.sevenkingdoms.local: House Stark domain
- essos.local: Daenerys Targaryen domain
- sevenkingdoms.local: King's Landing domain
⚠️ Legacy Edition Status
The legacy Neo4j edition is kept for archival purposes only and no longer receives active development. We strongly recommend using the BloodHound Community Edition (CE) client, which is the maintained and tested path in this CLI.
🎯 Roadmap
- Complete all Legacy queries for CE
- Add more advanced query capabilities
- Enhanced error handling and logging
- Performance optimizations
- Additional test coverage
📄 License
This project is licensed under the MIT License.
🤝 Contributing
- Fork the repository
- Create a feature branch
- Add tests for new functionality
- Ensure all tests pass
- Submit a pull request
📞 Support
For issues and questions:
- Create an issue on GitHub
- Check the test suite for usage examples
- Review the integration tests for setup guidance
Release files for bloodhound-cli 1.2.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| bloodhound_cli-1.2.6.tar.gz | 42.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| bloodhound_cli-1.2.6-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 85.6 kB
Release files / bloodhound_cli-1.2.6.tar.gz
| Download URL | bloodhound_cli-1.2.6.tar.gz |
|---|---|
| Size | 42.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2e318dec93dcf8440a3e1b7f6c1fc55ad0ab562e6f0cb85f99f8376051e9b8e0
|
|
BLAKE2b-256 checksum How to use checksums |
b6af25ad7d2b226a11d0390ee2b0fc0e76b73ede9c673ca7c7ed2691e3c1ec64
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.25
|
Release files / bloodhound_cli-1.2.6-py3-none-any.whl
| Download URL | bloodhound_cli-1.2.6-py3-none-any.whl |
|---|---|
| Size | 43.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1bbd9bd6873cbc016a8356639adbaea98a054de3e65106fa5d0c2b23e4504f6a
|
|
BLAKE2b-256 checksum How to use checksums |
603644fd4510327d2f7ca1159145c4da295032f1755632b5585d87ff6d26cd95
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.25
|