shadow1ng/fscan · error

netbios_query_send_failed: %w

Error message

netbios_query_send_failed: %w

What it means

Guard in queryNetBIOSNames: the UDP socket to port 137 was established but conn.Write of the 50-byte NetBIOS name query packet failed. The query never left the sender, usually due to a closed socket, local network failure, or deadline expiry.

Source

Thrown at plugins/services/netbios.go:178

		0x20, 0x43, 0x4B, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
		0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
		0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x00, 0x00, 0x21, 0x00, 0x01,
	}

	target := fmt.Sprintf("%s:137", host)

	conn, err := net.DialTimeout("udp", target, config.ModuleTimeout())
	if err != nil {
		return nil, fmt.Errorf("%s: %w", i18n.GetText("netbios_name_connect_failed"), err)
	}
	state.IncrementUDPPacketCount()
	defer func() { _ = conn.Close() }()

	_ = conn.SetDeadline(time.Now().Add(config.ModuleTimeout()))

	_, err = conn.Write(queryPacket)
	if err != nil {
		return nil, fmt.Errorf("%s: %w", i18n.GetText("netbios_query_send_failed"), err)
	}

	response := make([]byte, 1024)
	n, err := conn.Read(response)
	if err != nil {
		return nil, fmt.Errorf("%s: %w", i18n.GetText("netbios_response_read_failed"), err)
	}

	return p.parseNetBIOSNames(response[:n])
}

// queryNetBIOSSession 查询NetBIOS会话服务(TCP 139)
func (p *NetBIOSPlugin) queryNetBIOSSession(ctx context.Context, host string, session *common.ScanSession) (*NetBIOSInfo, error) {
	target := fmt.Sprintf("%s:139", host)

	conn, err := session.DialTCP(ctx, "tcp", target, session.Config.ModuleTimeout())
	if err != nil {
		return nil, fmt.Errorf("%s: %w", i18n.GetText("netbios_session_connect_failed"), err)

View on GitHub (pinned to 95cc12e753)

Solutions

  1. Check local network interface health and routing
  2. Retry the query; UDP sends can fail transiently
  3. Increase the deadline to accommodate slow networks
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at plugins/services/netbios.go:178 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of shadow1ng/fscan@95cc12e753 (2026-09-06). Data as JSON: /api/errors/92ca2a724264f568. Report an issue: GitHub.