feat: add GOAD variant generator for randomized AD lab environments#62
Merged
Conversation
**Added:** - Introduced a `variant` subcommand to generate randomized GOAD lab variants with preserved structure and attack paths (`cli/cmd/variant.go`) - Added a `diagnose` command to run domain controller diagnostics (`cli/cmd/diagnose.go`) - Implemented a full variant generator with entity mapping, transformation, and mapping documentation (`cli/internal/variant/generator.go`) - Added a name generator for unique, realistic usernames, hostnames, groups, OUs, and passwords (`cli/internal/variant/namegen.go`) - Comprehensive unit and end-to-end tests for generator logic and name generation (`cli/internal/variant/generator_test.go`, `cli/internal/variant/namegen_test.go`) **Changed:** - No changes to existing files; all functionality introduced in new files **Removed:** - Nothing removed
Replaced flat list of 94 individual role nodes with 8 high-level categories (Active Directory, Server Roles, LAPS, Vulnerabilities, SCCM, Security, Settings, Playbooks) for improved readability.
**Added:** - Introduced helper functions for collecting passwords from domains, hosts, MSSQL, and vulnerabilities to modularize password mapping logic - Added helper methods to build ordered replacements, such as `appendHostReplacements`, `appendQualifiedUserReplacements`, `appendDNReplacements`, and `appendDomainReplacements` - Created `mapUserNameComponents` to encapsulate user name mapping logic - Added `findNameViolations` and `printViolations` functions for clearer validation reporting - Defined a `charClasses` type with helpers for password character analysis in password generation logic **Changed:** - Refactored `mapPasswords` to delegate password collection to new helper functions, improving clarity and maintainability - Refactored the construction of ordered replacements to use new modular methods, reducing code repetition and improving logical grouping - Refactored validation logic to use new helper functions for violation finding and reporting, and extracted structure count validation to a dedicated method - Improved password generation logic to more accurately match the character classes of the original password, ensuring complexity is preserved and code is clearer - Extracted and reused test configuration setup in generator tests, reducing duplication and clarifying test intent **Removed:** - Eliminated repetitive code for iterating and mapping over various password sources and replacement categories - Removed inline logic in favor of calling newly added modular helper functions throughout generator and test code
**Changed:** - Fixed character validation logic in the name component check to properly identify valid alphabetic characters and reject invalid ones in the `isNameComponent` method of the generator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Key Changes:
Added:
cli/internal/variant/generator.goto performentity extraction, randomization, mapping, file transformation, and validation for all
Active Directory objects (domains, users, hosts, groups, OUs, passwords, etc.)
cli/internal/variant/namegen.gofor realistic, unique,pronounceable entity names (domains, users, hosts, groups, OUs, passwords, cities, etc.)
variantandvariant generatecommands incli/cmd/variant.goto invoke the generator with flexible source/target parametersdiagnosecommand incli/cmd/diagnose.goto runconnectivity and service checks between domain controllers via Ansible
generator in
cli/internal/variant/generator_test.goandnamegen_test.goChanged:
CLI application, ensuring seamless user experience and maintainability