Repository navigation
fix(wordlist-gen): parse flags interspersed and reject positionals (#120) - #133
Merged
TMHSDigital merged 1 commit intoOct 6, 2026
Merged
Conversation
…MHSDigital#120) wordlist-gen called fs.Parse directly, which stops at the first non-flag argument. 'wordlist-gen acme.com -o out.txt' therefore silently ignored both acme.com and the -o after it and wrote ./wordlist.txt. Use the same interspersed parsing as main.go, reject leftover positionals with a -domain hint (exit 2), and return the usage code (2) for an invalid -combine value or an empty -o instead of 1.
TMHSDigital
added a commit
that referenced
this pull request
Oct 6, 2026
Domain-argument checks move to validateArgs, which runs before any input file is read, so `subenum -exclude-file missing.txt` says the domain is missing instead of failing on the file. The wordlist-gen part of #120 is in PR #133. Refs #120 Co-Authored-By: Claude Opus 5.5 <[email protected]>
TMHSDigital
added a commit
that referenced
this pull request
Oct 6, 2026
#133 was branched before v0.9.0 was cut, so its entry merged into the 0.9.0 section; the fix is not in that release. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Owner
|
Thanks for this, @kragent66-glitch — clean fix, and the before/after table and sabotage check made it easy to verify (all reproduced locally). Merged. One housekeeping note: v0.9.0 was cut while this was open, so the CHANGELOG line landed in the 0.9.0 section on merge; I moved it to Unreleased in a follow-up commit. Your note about sharing |
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.
Description
tools/wordlist-gencalledfs.Parsedirectly, so the standard flag package stopped at the first non-flag argument:wordlist-gen acme.com -o out.txtsilently ignored bothacme.comand the-oafter it, exited 0, and wrote./wordlist.txt. An invalid-combinevalue and an empty-oalso exited 1 instead of 2.This change:
wordlist-genthe same interspersed parsingmain.gouses (parseInterspersed+endsWithTerminator), so flags written after a positional are still parsed;Error: unexpected argument "acme.com"; to take subdomains from a domain, pass -domain acme.comand exit 2;-combinevalue and an empty-o(was 1).Runtime errors that are correctly 1 are unchanged: an existing file without
-f, "no entries generated", and file create/write errors.Note on the rest of #120
The other two items in the issue are already satisfied at HEAD
de87d846and documented inCHANGELOG.md(Unreleased → Fixed): an unreadable-rfile exits 1 (loadPool,main.go:345-349) and argument errors are reported before the simulation banner (validateFlags,main.go:601-616). This PR covers the remainingwordlist-genitems.Closes #120
Type of Change
Checklist
gofmtclean)CHANGELOG.mdbullet)Verification
Run locally on this branch:
go build ./...— OKgo test -race ./...— all packagesokEnd-to-end with the built tool:
wordlist-gen acme.com./wordlist.txt-domainwordlist-gen acme.com -o out.txt-owordlist-gen -combine 'bad!.x' -o c.txtwordlist-gen -o ''wordlist-gen -domain acme.com -o ok.txtSabotage check: the new/updated tests fail on the pre-fix
wordlist-gen.go(every case reported exit 1) and pass with the fix.TestRunGuardswas updated to expect 2 for an invalid-combine.Known issues
parseInterspersed/endsWithTerminatorare copied verbatim frommain.gobecause thetools/tool is a separatepackage mainand cannot import the root package. Sharing them through a small internal package is a possible follow-up; I kept it a copy to hold the diff minimal.Ethical Considerations