Skip to content

CLI and TUI build scans separately and have drifted (skipped-entry count, seed, DNS validation, defaults) #80

Closed

Description

@TMHSDigital

Why it matters

main.go and internal/tui/model.go each turn user options into a scan.Config and validate them separately. They have already diverged, and every new flag widens the gap. This is the root cause behind several TUI-only bugs (#35, #55).

Evidence of drift

  • Skipped-entry count. The TUI discards it (entries, _, _, err := wordlist.LoadWordlist(...), internal/tui/model.go:116). The CLI reports "Skipped N invalid wordlist entries" (main.go:503).
  • Simulation seed. The TUI uses Seed: rand.Uint64() (model.go:153) and never shows it, so TUI simulations can't be reproduced. The CLI prints the seed (main.go:396).
  • DNS server validation. The TUI validates the server even in simulate mode (form.go:369); the CLI skips it (main.go:244).
  • Default resolver. 8.8.8.8:53 is hard-coded in form.go:118, form.go:367 and validate.go:14, in addition to main.DefaultDNSServer.
  • Range checks. Attempts, depth, rate and max-queries are checked in both places separately.
  • Config save. internal/tui/config.go:85 saves with os.WriteFile, which truncates and then writes. A second instance reading at the same moment gets partial JSON, and loadSavedConfig silently falls back to defaults.

Suggested approach

  • Add a shared Options struct with Validate() error and ToScanConfig(), for example in internal/scan or a new internal/config. Both front ends use it.
  • Move the default resolver into a single constant.
  • Show the TUI seed in the scan header and the skipped count as a notice.
  • Write the config to a temp file and os.Rename it over the real one.

Done when

main.go and the TUI both call the same validator and builder, and a table test asserts that both front ends produce an identical scan.Config from the same options.

Activity

  1. added
    enhancement
    priority: medium
    area: cli
    area: tui
    on Oct 5, 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: cliarea: tuienhancementpriority: medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions