fix: MSSQL 连接加 encrypt=disable 修复无 TLS 环境扫描失败,Web API 参数校验负数
测试构建 / 代码检查 (push) Has been cancelled
测试构建 / 单元测试和构建 (push) Has been cancelled
测试构建 / 构建验证 (push) Has been cancelled

This commit is contained in:
ZacharyZcR
2026-04-28 15:24:01 +08:00
parent 4f98091fa3
commit 533a4ed7f8
2 changed files with 4 additions and 4 deletions
+2 -2
View File
@@ -65,7 +65,7 @@ func (p *MSSQLPlugin) createAuthFunc(info *common.HostInfo, config *common.Confi
// doMSSQLAuth 执行MSSQL认证
func (p *MSSQLPlugin) doMSSQLAuth(ctx context.Context, info *common.HostInfo, cred Credential, config *common.Config, state *common.State) *AuthResult {
connStr := fmt.Sprintf("server=%s;user id=%s;password=%s;port=%d;database=master;connection timeout=%d",
connStr := fmt.Sprintf("server=%s;user id=%s;password=%s;port=%d;database=master;encrypt=disable;connection timeout=%d",
info.Host, cred.Username, cred.Password, info.Port, int64(config.Timeout.Seconds()))
db, err := sql.Open("mssql", connStr)
@@ -148,7 +148,7 @@ func classifyMSSQLErrorType(err error) ErrorType {
func (p *MSSQLPlugin) identifyService(ctx context.Context, info *common.HostInfo, config *common.Config, state *common.State) *ScanResult {
target := info.Target()
connStr := fmt.Sprintf("server=%s;user id=invalid;password=invalid;port=%d;database=master;connection timeout=%d",
connStr := fmt.Sprintf("server=%s;user id=invalid;password=invalid;port=%d;database=master;encrypt=disable;connection timeout=%d",
info.Host, info.Port, int64(config.Timeout.Seconds()))
db, err := sql.Open("mssql", connStr)
+2 -2
View File
@@ -185,7 +185,7 @@ func (h *ScanHandler) runScan(req ScanRequest) {
fv.ScanMode = "all"
}
fv.ThreadNum = req.ThreadNum
if fv.ThreadNum == 0 {
if fv.ThreadNum <= 0 {
fv.ThreadNum = 600
}
fv.TimeoutSec = int64(req.Timeout)
@@ -193,7 +193,7 @@ func (h *ScanHandler) runScan(req ScanRequest) {
fv.TimeoutSec = 3
}
fv.ModuleThreadNum = req.ModuleThreadNum
if fv.ModuleThreadNum == 0 {
if fv.ModuleThreadNum <= 0 {
fv.ModuleThreadNum = 20
}
fv.DisablePing = req.DisablePing