mirror of
https://github.com/shadow1ng/fscan.git
synced 2026-09-22 03:10:42 +08:00
fix: MSSQL 连接加 encrypt=disable 修复无 TLS 环境扫描失败,Web API 参数校验负数
This commit is contained in:
@@ -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
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user