{"record":{"id":"7178306f537b0323","repo":"shadow1ng/fscan","slug":"service-conn-port-failed-w","errorCode":null,"errorMessage":"service_conn_port_failed: %w","messagePattern":"service_conn_port_failed: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"plugins/services/findnet.go","lineNumber":58,"sourceCode":"func (p *FindNetPlugin) Scan(ctx context.Context, info *common.HostInfo, session *common.ScanSession) *ScanResult {\n\tconfig := session.Config\n\ttarget := info.Target()\n\n\t// 检查是否为RPC端口\n\tif info.Port != 135 {\n\t\treturn &ScanResult{\n\t\t\tSuccess: false,\n\t\t\tService: \"findnet\",\n\t\t\tError:   fmt.Errorf(\"%s\", i18n.Tr(\"service_port_restriction\", \"FindNet\", \"135\")),\n\t\t}\n\t}\n\n\tconn, err := session.DialTCP(ctx, \"tcp\", target, config.ModuleTimeout())\n\tif err != nil {\n\t\treturn &ScanResult{\n\t\t\tSuccess: false,\n\t\t\tService: \"findnet\",\n\t\t\tError:   fmt.Errorf(i18n.Tr(\"service_conn_port_failed\", \"%w\"), err),\n\t\t}\n\t}\n\tdefer func() { _ = conn.Close() }()\n\n\t// 设置超时\n\t_ = conn.SetDeadline(time.Now().Add(config.ModuleTimeout()))\n\n\t// 执行RPC网络发现\n\tnetworkInfo, err := p.performNetworkDiscovery(conn)\n\tif err != nil {\n\t\treturn &ScanResult{\n\t\t\tSuccess: false,\n\t\t\tService: \"findnet\",\n\t\t\tError:   err,\n\t\t}\n\t}\n\n\t// 记录发现的网络信息 (一次性输出，避免被其他日志打断)","sourceCodeStart":40,"sourceCodeEnd":76,"githubUrl":"https://github.com/shadow1ng/fscan/blob/95cc12e753bf43de7004e5aef42a9ffba3934303/plugins/services/findnet.go#L40-L76","documentation":"The FindNet plugin's TCP connection to the target (port 135) failed in session.DialTCP, so Scan returns this wrapped error (%w wraps the underlying net error) from i18n key service_conn_port_failed. It reports that the endpoint mapper could not be reached, before any RPC bind or enumeration is attempted.","triggerScenarios":"Dialing host:135 fails because the port is closed, a firewall drops/denies the packet, DNS fails for the host, the dial times out after config.ModuleTimeout(), or the session's network layer (proxy/dialer) is misconfigured.","commonSituations":"Windows hosts with RPC endpoint mapper firewalled (common on hardened networks); scanning across network segments without routing; timeout too short for slow WAN links; target host powered off or IP changed.","solutions":["Read the wrapped error: 'connection refused' means port closed/filtered-reject; 'i/o timeout' means dropped packets (firewall); 'no such host' means DNS.","Confirm port 135 is reachable with nc -zv host 135 from the scanning host.","Increase config.ModuleTimeout() if the link is slow, and verify proxy settings if the scan routes through one.","Skip or deprioritize hosts where 135 is filtered — RPC enumeration cannot proceed without it."],"exampleFix":"// before\nsession.DialTCP(ctx, \"tcp\", target, 2*time.Second) // i/o timeout on WAN\n// after\nsession.DialTCP(ctx, \"tcp\", target, config.ModuleTimeout()) // e.g. 10s, tuned in config","handlingStrategy":"retry","validationCode":"conn, err := net.DialTimeout(\"tcp\", net.JoinHostPort(info.Host, \"135\"), 3*time.Second)\nif err != nil {\n    return fmt.Errorf(\"host %s:135 not reachable: %w\", info.Host, err)\n}\nconn.Close()","typeGuard":null,"tryCatchPattern":"res := plugin.Scan(ctx, info, session)\nvar nerr net.Error\nif res.Error != nil && (errors.As(res.Error, &nerr) || errors.Is(res.Error, syscall.ECONNREFUSED)) {\n    // back off and retry, or mark host:135 dead and skip RPC enumeration\n    return retryWithBackoff(ctx, info, session)\n}","preventionTips":["Probe port 135 reachability before RPC enumeration","Tune ModuleTimeout for slow links","Check firewall rules for 135 on target subnets","Classify wrapped net errors to decide retry vs permanent skip"],"tags":["go","network","tcp","windows","rpc"],"backgroundTag":"connection-refused","analyzedSha":"95cc12e753bf43de7004e5aef42a9ffba3934303","analyzedAt":"2026-09-06T17:07:30.094Z","contentChangedAt":"2026-09-06T17:07:30.094Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}