mirror of
https://github.com/shadow1ng/fscan.git
synced 2026-09-27 05:31:53 +08:00
fix(portfinger): 修复SMB2服务指纹识别和NetInfo输出问题
- 添加SMB2ProgNeg探针支持现代Windows的SMB2协议 - 修复Go regexp对高位字节的UTF-8兼容问题,使用Latin-1转换 - 修复探针失败后连接重建逻辑 - 修复vendor_product字段名不匹配问题 - 修复NetInfo多行输出被其他日志打断的问题
This commit is contained in:
@@ -225,6 +225,8 @@ func (s *SmartPortInfoScanner) tryProbeList(probes []*Probe, usedProbes map[stri
|
||||
|
||||
response := s.info.Connect(probeData)
|
||||
if len(response) == 0 {
|
||||
// 连接可能被关闭(如服务端返回 EOF),尝试重建连接后继续下一个探针
|
||||
s.reconnectIfNeeded()
|
||||
continue
|
||||
}
|
||||
|
||||
@@ -238,6 +240,26 @@ func (s *SmartPortInfoScanner) tryProbeList(probes []*Probe, usedProbes map[stri
|
||||
return false
|
||||
}
|
||||
|
||||
// reconnectIfNeeded 强制重建连接
|
||||
// 当探针收到空响应时调用,说明连接可能已被服务端关闭
|
||||
func (s *SmartPortInfoScanner) reconnectIfNeeded() {
|
||||
// 关闭旧连接
|
||||
if s.info.Conn != nil {
|
||||
_ = s.info.Conn.Close()
|
||||
s.info.Conn = nil
|
||||
s.Conn = nil
|
||||
}
|
||||
|
||||
// 重新建立连接
|
||||
newConn, err := common.WrapperTcpWithTimeout("tcp", fmt.Sprintf("%s:%d", s.Address, s.Port), s.Timeout)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
s.info.Conn = newConn
|
||||
s.Conn = newConn
|
||||
}
|
||||
|
||||
// performSSLSecondStage 执行 SSL 多阶段探测
|
||||
// 参考 gonmap 的策略:ssl → ssl-specific probes → https
|
||||
func (s *SmartPortInfoScanner) performSSLSecondStage(serviceInfo *ServiceInfo) *ServiceInfo {
|
||||
|
||||
Reference in New Issue
Block a user