feat(smb): add generic --export flag for enumeration commands#1101
feat(smb): add generic --export flag for enumeration commands#1101H1DroZz wants to merge 4 commits intoPennyw0rth:mainfrom
Conversation
- Add --rid-users-export argument in proto_args.py - Implement rid_users_export() method in smb.py - Filter and export only SidTypeUser entries - Add E2E test
|
Hi and thanks for the PR. I don't think we should add even more |
|
@H1DroZz do you have the time to implement that change? |
Add --export FILE argument to SMB protocol that works alongside --rid-brute and --users, replacing the need for command-specific export flags. Filters SidTypeUser entries (excluding machine accounts) when exporting from --rid-brute.
Hello, it's done. Following your feedback, I replaced --rid-users-export with a generic --export flag that works alongside both --rid-brute and --users. While implementing this, I noticed --users-export follows the same pattern you pointed out. Would you like me to deprecate it in favor of --export as well, or would you prefer to keep it for backward compatibility? Have a nice day |
Yes please, we should deprecate the Thanks you too :) |
|
Hello @NeffIsBack I've implemented the deprecation of Let me know if this approach looks good to you or if you'd like any adjustments! Have a nice day |
|
So currently we have multiple functions for each flag that is exported. The goal is to have only one function per enumeration logic (e.g. if self.args.export:
self.export(data)for each of the enumeration functions. The export function would then simply dump the input data to file. |
- use a single --export-backed helper in smb protocol - remove deprecated SMB --users-export argument and dedicated handlers - fix SAMR user dump return path so --users --export exports real results - add e2e command for --rid-brute 10000 --export
|
@Marshall-Hallenbeck the template runner crashed here as well |
Description
This PR aligns SMB export behavior with review feedback from #1101 by enforcing:
--users,--rid-brute)--export FILE)Instead of maintaining command-specific export handlers, enumeration functions now return data and reuse a single export routine.
What Changed
--export.--usersflow to enumerate first, then export via the shared export path.--rid-bruteflow to enumerate first, then export onlySidTypeUserusernames (excluding machine accounts ending with$).--users-exportargument in favor of the unified--users --exportpattern.--users --exportexports the actual enumerated list.--rid-brute 10000 --export ...).Supported Commands (SMB)
--users --export <file>Exports enumerated domain users from SAMR user enumeration.
--rid-brute [MAX_RID] --export <file>Exports
SidTypeUserusernames found via RID bruteforce (machine accounts excluded).Notes
--rid-brutecoverage depends onMAX_RID.Some users may be missed with low RID ceilings; using a higher value (for example
10000) can be required depending on environment.Validation Performed
--users --exportvalidated: exported user count matches enumeration output.--rid-brute --exportvalidated: exports filtered user-only results as expected.Type of Change
--exportas single export path)Setup Guide for Review
Python: 3.10+
OS: Linux
Target: Windows Domain Controller
Examples:
Checklist:
Insert an "x" inside the brackets for completed and relevant items (do not delete options)
poetry run python -m ruff check . --preview, use--fixto automatically fix what it can)tests/e2e_commands.txtfile if necessary (new modules or features are required to be added to the e2e tests)