Skip to content

-dns-server rejects a bare IP that -r accepts #417

Closed

Description

@TMHSDigital

Summary

-dns-server 1.1.1.1 is rejected with "invalid format, expected ip:port", but the same bare IP works in a -r file, and tls:// addresses get a default port.

Where

  • internal/validate/validate.go:68-75 (plain transport requires host:port)
  • internal/validate/validate.go:20-30 (tls:// defaults to 853)
  • internal/dns/pool.go:111-113 (-r appends :53 to a bare IP)
  • docs/_includes/flags.md:13

Details

DNSServer calls net.SplitHostPort on the plain form and fails when the port is missing. validate_test.go:21 expects "missing port".

Impact

This is small but common friction. Users type -dns-server 1.1.1.1, as they would with dig, dnsx and most resolver lists, and get an error. The TUI's DNS Server field, the config file and SUBENUM_DNS_SERVER all hit the same check.

Suggested fix

Add validate.NormalizeDNSServer, which appends :53 to a bare IPv4 or IPv6 literal (bracketing IPv6). Call it wherever -dns-server, the TUI field, subenum mcp -dns-server and pkg/subenum Config.Resolver are read, then validate as before. Change the help text to ip[:port].

Acceptance criteria

  • -dns-server 1.1.1.1 and -dns-server 2606:4700:4700::1111 work and use port 53
  • The help text, flag table and validate tests are updated

Getting started

  • Relevant files: internal/validate/validate.go, internal/validate/validate_test.go
  • How to run tests: go test ./internal/validate/

Filed by repo-audit/full-audit at dd5b156. Severity: low. Effort: S. audit-key: enhancement|internal/validate/validate.go|DNSServer

Activity

  1. prascli commented on Nov 17, 2026

    @prascli
    Contributor

    Opened a PR that implements this: #425

    It adds validate.NormalizeDNSServer, which appends port 53 to a bare IPv4 or IPv6 literal, and calls it in the CLI, MCP server, TUI, scan runner, and library entry points. Help text and the generated flag table now read ip[:port]. All tests in the affected packages pass.

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