fix: 修复RDP爆破高误报率问题 (#555)

- 移除 screen.go 中错误的认证结果覆盖逻辑
- 启用 NLA 协议的 ErrorCode 字段检测
- 添加 PubKeyAuth 验证确保认证真正成功
- 修复 io.go 中错误被静默忽略的问题
- 修复 socket.go/io.go 中可能导致 panic 的代码
- 修复 screen.go 中文件句柄泄漏和 log.Panic
This commit is contained in:
ZacharyZcR
2026-01-14 22:54:31 +08:00
parent 98c6ec3e2f
commit 90c7f9c27e
5 changed files with 47 additions and 32 deletions
+8 -1
View File
@@ -69,6 +69,13 @@ func (s *SocketLayer) TlsPubKey() ([]byte, error) {
if s.tlsConn == nil {
return nil, errors.New("TLS conn does not exist")
}
pub := s.tlsConn.ConnectionState().PeerCertificates[0].PublicKey.(*rsa.PublicKey)
certs := s.tlsConn.ConnectionState().PeerCertificates
if len(certs) == 0 {
return nil, errors.New("no peer certificates")
}
pub, ok := certs[0].PublicKey.(*rsa.PublicKey)
if !ok {
return nil, errors.New("invalid public key type")
}
return asn1ber.Marshal(*pub)
}