Skip to content

-permute and -dry-run gaps: seeds-only pass, custom words, resolver pool #376

Done

Description

@TMHSDigital

Summary

Three smaller gaps in -permute and -dry-run.

1. -permute cannot run from -seeds alone; a permute-only pass needs a throwaway main scan

  • Where: internal/cli/cli.go:262, internal/cli/wordlist.go:56-76, internal/cli/permute.go:65-84
  • What happens: -seeds "implies -permute" (cli.go:262), but the permutation pass only runs after a main pass over the wordlist; omitting -w selects the bundled 5000-entry list (wordlist.go:58-62), and an empty -w file is refused. Verified with the built binary: subenum -simulate -seed 1 -w empty.txt -seeds seeds.txt lab.example exits 1 with Error: wordlist empty.txt has no valid entries. Issue search for "permute only", "permute-only", "skip the main", "without the main": no hits; Permutation / alteration mode for second-stage brute-forcing #72 (the -permute feature) does not cover it.
  • Impact: The second-stage workflow Permutation / alteration mode for second-stage brute-forcing #72 targets (earlier results in, alterations out) costs a full bundled-wordlist scan of the target each time (10,000 extra queries with the default types), or a hand-made one-line dummy wordlist that still queries that name.
  • To see it: As above.
  • Suggested fix: When -seeds is given with an explicit "no wordlist" (-w "" already means "bundled", so a new value such as -w none or a -permute-only flag), skip the main pass and run runPermutationPass with found empty and the seeds as the only input. Make -dry-run count the permutation candidates in this mode, since they are known without a scan.

2. -permute uses a fixed 30-word list; the CLI cannot pass the custom words the library accepts

  • Where: internal/permute/permute.go:16-21, internal/candidates/candidates.go:164, pkg/subenum/subenum.go:449-458
  • What happens: candidates.Permutations always calls permute.Generate(rel, permute.Words, skip) (candidates.go:164), and permute.Words is a hard-coded list of 30 environment/role names (permute.go:16-21). The public library already takes custom words (subenum.Permutations(seeds, words), nil = built-in, subenum.go:449-458), so the CLI is the only surface without the option. Labels the scan itself discovered (for example payments in payments.example.com) are never combined with other seeds. Issue search for "permute-words", "permutation words", "custom words": no hits.
  • Impact: Permutation hit rates depend on an organisation's own naming (-eu1, -k8s, product names); users who know them have to switch to an external alteration tool and lose subenum's guarded second pass.
  • Suggested fix: Add -permute-words <file> (one word per line, # comments, same normalisation as wordlists), merged with the built-in list or replacing it (-permute-words-only, mirroring -takeover-providers-only), threaded through candidates.Permutations. Optionally add the distinct leftmost labels of the main pass's hits to the word set (capped). Record the words file in the resume input fingerprint, as the wordlist is, so a resumed permute pass rebuilds the same candidates.

3. -dry-run ignores the resolver pool: no per-resolver preflight, and -rate-per-resolver is not in the duration

  • Where: internal/cli/dryrun.go:40-76, internal/cli/dryrun.go:115-119, internal/cli/session.go:109-114, internal/cli/cli.go:268
  • What happens: loadInputs builds s.in.pool from -r before dryRun runs (session.go:109-114), but dryRun never reads it. The preflight goes only to f.dnsServer (dryrun.go:43, :70-71), and the duration estimate uses only f.rate (dryrun.go:65-68); with -r pool.txt -rate-per-resolver 20 and no -rate, which the help explicitly allows ("-rate still caps the total (0 = unlimited)", cli.go:268), the plan prints duration not bounded by -rate (unlimited) (dryrun.go:118) although the scan is capped at 20 x pool size queries/s.
  • Impact: The users who most need a plan before a big run, those using a resolver pool for a large wordlist, get a duration line that says "unlimited" and learn only mid-scan that part of their pool times out or is benched. Lab users are unaffected.
  • To see it: Reasoned from code (a live pool cannot be exercised hermetically here): subenum -dry-run -r pool.txt -rate-per-resolver 20 -w big.txt example.com prints the unlimited duration line and one preflight line for 8.8.8.8:53.
  • Suggested fix: When s.in.pool != nil, compute the effective rate as min(rate, ratePerRes * pool.Size()) (either term 0 meaning no bound) for the estimate, and say which flag bounds it. Add one preflight per pool member (one query each, the same kind of traffic the dry run already sends) and print a per-resolver ok/failed line. Keep the JSON plan in step (pool_preflight array, rate_effective).

Acceptance criteria

  • -permute cannot run from -seeds alone; a permute-only pass needs a throwaway main scan
  • -permute uses a fixed 30-word list; the CLI cannot pass the custom words the library accepts
  • -dry-run ignores the resolver pool: no per-resolver preflight, and -rate-per-resolver is not in the duration

Related: #72

Getting started

  • Relevant files: internal/cli/cli.go, internal/cli/wordlist.go, internal/cli/permute.go, internal/permute/permute.go, internal/candidates/candidates.go, pkg/subenum/subenum.go
  • How to run tests: go test ./... (tests must stay hermetic: use -simulate, a lab zone or internal/dnstest, never a live domain)
  • Related docs: docs/DEVELOPER_GUIDE.md, docs/ARCHITECTURE.md

Filed by repo-audit/full-audit at 0f3b0b6. Severity: low. Effort: M. audit-key: enhancement|internal/cli/permute.go|permute-dryrun-gaps

Activity

  1. added
    enhancement
    help wanted
    area: cli
    severity: low
    on Nov 16, 2026
  2. TMHSDigital commented on Nov 17, 2026

    @TMHSDigital
    OwnerAuthor

    Item 3 is done in 43579aa: -dry-run now sends the target's preflight query to each -r pool resolver too and prints a line for each one (pool_preflight in JSON). The duration estimate uses min(-rate, -rate-per-resolver x pool size), where 0 on either side means no bound, and the JSON shows it as rate_effective. A pool resolver that fails is reported but does not fail the dry run, because a scan would bench it and keep going.

    Verified with TestDryRunResolverPool, which runs against local DNS servers: one pool resolver answers and one SERVFAILs, it checks -rate 0 and -rate 4, the text output, and that pool resolvers receive only the preflight query. The full suite, vet and golangci-lint pass.

    Items 1 and 2 are still open because each needs a decision first:

    1. Seeds-only permute pass: how should the user say there is no wordlist? A new value like -w none, or a new flag such as -permute-only? And should -dry-run count the permutation candidates in that mode?
    2. Custom permutation words: is the flag name -permute-words <file>? Should the file add to the built-in list, or replace it, possibly through a separate -permute-words-only? Should labels found during the main pass be added to the words automatically, and up to what cap?
  3. TMHSDigital commented on Nov 29, 2026

    @TMHSDigital
    OwnerAuthor

    Items 1 and 2 are done in b2f56b3, so all three are now done (item 3 was 43579aa):

    • -permute-only needs -seeds and runs only the permutation pass over them, with no wordlist scan. -dry-run counts its candidates. It refuses -w, -hosts, -recursive and -recursive-w, and also the candidate sources that only feed the skipped scan (-ct, -sources, -axfr, -nsec-walk, -srv, -follow-records), plus -tui. A run can be resumed.
    • -permute-w <file> replaces the built-in 30 permutation words. Like -recursive-w, it is repeatable, - reads stdin, it can be set in the config file or SUBENUM_PERMUTE_W, and a resume refuses a changed file.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: clienhancementhelp wantedseverity: low

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions