Thanks for your interest in contributing to MSSQLHound! This guide will help you get started.
Before diving into code, feel free to reach out:
- BloodHound Slack: @Mayyhem
- Twitter/X: @_Mayyhem
- GitHub Issues: Open an issue
If you're planning a significant change, please open an issue first to discuss the approach.
MSSQLHound/
├── cmd/mssqlhound/ # CLI entry point
├── internal/ # Internal packages
│ ├── ad/ # Active Directory / LDAP integration
│ ├── bloodhound/ # BloodHound output formatting
│ ├── collector/ # Core edge/node collection logic
│ ├── epamatrix/ # EPA matrix testing
│ ├── mssql/ # SQL Server protocol and authentication
│ ├── proxydialer/ # SOCKS5 proxy support
│ ├── types/ # Shared data structures
│ ├── winrmclient/ # WinRM client for EPA testing
│ └── wmi/ # WMI service account collection (Windows)
├── go.mod # Go module definition
├── go.sum # Go dependency checksums
├── TESTING.md # Comprehensive testing guide
├── saved_queries/ # Pre-built BloodHound Cypher queries
├── util/ # Utility scripts
│ └── compare_edges.py # Edge comparison tool (Python 3, no dependencies)
├── powershell_deprecated/ # Original PowerShell implementation (archived)
└── MSSQL Design.json # Graph model definition
- Go 1.24+ (for building and testing)
- Python 3 (only needed for utility scripts in
util/) - Git
go build -o mssqlhound ./cmd/mssqlhoundThe build produces a single standalone binary with no external runtime dependencies. Cross-compilation works for Windows, Linux, and macOS.
Unit tests run without any external infrastructure:
go test ./...Run a specific test or match a pattern:
go test -v -run TestContainsEdges ./internal/collector/...
go test -v -run MemberOf ./internal/collector/...Integration tests require a live SQL Server instance and Active Directory environment. They are gated behind a build tag:
MSSQL_SERVER=sql.example.com \
MSSQL_USER=sa \
MSSQL_PASSWORD='P@ssw0rd' \
MSSQL_DOMAIN=example.com \
MSSQL_DC=10.0.0.1 \
LDAP_USER='EXAMPLE\admin' \
LDAP_PASSWORD='LdapP@ss' \
go test -v -tags integration -timeout 30m -run TestIntegrationAll ./internal/collector/...See TESTING.md for the full testing guide, including:
- All environment variables and their defaults
- Integration test flow (setup, test, coverage, teardown)
- EPA matrix testing
- How to add tests for new edge types
- Fork and clone the repository
- Create a branch from
mainfor your changes - Make your changes following the code style conventions below
- Write tests for new functionality (especially new edge types)
- Run unit tests to verify nothing is broken
- Open a pull request against
main
MSSQLHound follows standard Go conventions:
- Formatting: Run
gofmt(orgoimports) on all Go files - Error handling: Wrap errors with context using
fmt.Errorf("...: %w", err) - Testing: Use the standard library
testingpackage (no external test frameworks) - Naming: CamelCase for exported symbols,
json:"snake_case"for struct tags - Documentation: Package-level
// Package <name>doc comments on each file - Receivers: Single-letter pointer receivers (e.g.,
func (c *Collector) ...) - Concurrency: Protect shared state with
sync.Mutex/sync.RWMutex
- Unit test files live alongside the code they test (
*_test.go, no build tag) - Integration tests use the
//go:build integrationbuild tag - Edge tests use the project's builder pattern and assertion helpers -- see TESTING.md for details
- Platform-specific code uses build-constrained files (e.g.,
wmi_windows.go,wmi_stub.go)
If you're adding a new MSSQL edge type, follow the step-by-step guide in TESTING.md. The process involves:
- Defining the edge in the collector
- Adding unit test cases using the test data builders
- Adding integration test coverage
- Documenting the edge in the README
When opening an issue, please include:
- MSSQLHound version (from
mssqlhound --versionor the release you downloaded) - Operating system and architecture
- SQL Server version you're collecting from
- Steps to reproduce the issue
- Expected vs. actual behavior
- Relevant log output (sanitize any credentials or sensitive hostnames)
- Target the
mainbranch - Keep PRs focused -- one logical change per PR
- Write a clear title and description explaining what changed and why
- Include tests for new edge types or significant logic changes
- Ensure all unit tests pass (
go test ./...) - Reference any related GitHub issues in the PR description
MSSQLHound is licensed under the GNU General Public License v3.0. By contributing, you agree that your contributions will be licensed under the same terms.