Skip to content

Exit-code and argument-handling leftovers: -r read errors exit 2, wordlist-gen ignores positionals and flags after them #120

Closed

Description

@TMHSDigital

Evidence

Suggested approach

  • Return exitFailure for I/O errors in loadPool and keep 2 for parse errors.
  • In wordlist-gen, use interspersed parsing (same helper as main) and reject positionals with "did you mean -domain?" (exit 2).
  • Validate arguments before printing banners.

Done when

Tests pin each exit code, and wordlist-gen acme.com exits 2 with a hint.

Activity

  1. kragent66-glitch commented on Oct 6, 2026

    @kragent66-glitch
    Contributor

    Hi — I'd like to pick this up.

    I verified each item against HEAD (de87d846) before starting, and the first two are already satisfied there:

    • -r exit code is already 1. A missing -r file now returns exitFailure (main.go:345-349, loadPool) — subenum -r /nonexistent example.com exits 1. Only the parse path (main.go:354-357) still returns exitUsage (2), which is the intended split.
    • Validation already runs before the banner. validateFlags is called before the SIMULATION banner block (main.go:601-616), so subenum -simulate with no domain prints "missing " first, not the banner.

    Still reproducing the wordlist-gen half on HEAD:

    • tools/wordlist-gen.go:156 calls fs.Parse directly, which stops at the first positional. wordlist-gen acme.com -o /tmp/out.txt exits 0, silently ignores both acme.com and the -o after it, and writes ./wordlist.txt (38 common entries).
    • An invalid -combine value and an empty -o both exit 1 instead of 2.

    I'll open a PR that gives wordlist-gen the same interspersed parsing as main.go, rejects leftover positionals with a -domain hint (exit 2), returns exitUsage for the invalid -combine/empty -o cases, and pins each exit code with tests.

  2. TMHSDigital commented on Oct 6, 2026

    @TMHSDigital
    OwnerAuthor

    Done on main: unreadable -r exits 1 (9a0df31), usage errors print before the simulation banner, and a missing domain is reported before a missing -exclude-file (b39fdc0). The wordlist-gen positional-argument part is in community PR #133, so this stays open until that lands.

  3. added a commit that references this issue on Oct 6, 2026
    3f74c79
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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions