Skip to content

Flags placed after the domain are silently ignored (scan runs with defaults, exit 0) #29

Closed

Description

@TMHSDigital

Why it matters

Go's flag package stops parsing at the first non-flag argument. Any flag placed after the domain is silently ignored, and the scan runs with defaults and exits 0. Putting flags after the target is a very common habit for users coming from other recon tools. Live-scan settings such as -rate, -max-queries, -dns-server, -o, or -simulate can be silently dropped. A user who wrote example.com -simulate gets a live scan.

Evidence

$ subenum -simulate -hit-rate 100 -w examples/sample_wordlist.txt example.com -t 0
... scan runs normally ...
exit=0            # -t 0 should have been rejected by validateFlags
  • main.go:113 flag.Parse()
  • main.go:118 checks only flag.NArg() == 0
  • main.go:157 domain := flag.Arg(0): anything in flag.Args()[1:] is discarded without a warning.
  • The main package has 4.6% test coverage, so run() flag handling is effectively untested.

Suggested approach

Choose one:

  • Strict: if flag.NArg() > 1, print the usage line and the ignored arguments, then exit 2.
  • Permissive: re-parse flag.Args()[1:] with the same FlagSet so flags work in either position, and still reject stray positionals.

Either way, exit with code 2 for usage errors, matching the flag convention.

Done when

  • subenum -w wl.txt example.com -t 0 either errors out or honours -t 0 and fails validation. It never runs silently with defaults.
  • A main_test.go table test covers flags before and after the domain, plus stray extra positionals.

Activity

  1. added
    bug
    priority: high
    area: cli
    on Oct 4, 2026
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: clibugpriority: high

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions