From 78b8ff4f8143aeef863b1262580bfa8e07b6c9df Mon Sep 17 00:00:00 2001 From: ZacharyZcR Date: Thu, 7 Aug 2025 09:54:56 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=89=AB=E6=8F=8F?= =?UTF-8?q?=E6=A8=A1=E5=BC=8F=E9=AA=8C=E8=AF=81=E5=92=8C=E5=B8=AE=E5=8A=A9?= =?UTF-8?q?=E6=96=87=E6=9C=AC=E8=BF=87=E6=97=B6=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复内容: - 移除ValidationParser中无效的扫描模式(main, web, db, service, top1000, custom) - 简化扫描模式验证逻辑,只保留真正支持的预定义模式(all, icmp) - 允许任何插件名称作为扫描模式,实际验证在运行时进行 - 更新帮助文本,移除过时的portscan/tcpscan/udpscan引用 技术改进: - 避免维护两套插件列表,减少维护成本 - 使验证逻辑与实际功能保持一致 - 提供更准确的用户指导信息 支持的扫描模式: - all: 运行所有插件 - icmp: 存活探测模式 - 插件名称: mysql, redis, ssh等任何注册插件 - 多插件: mysql,redis,ssh等逗号分隔格式 --- Common/i18n/messages/flag.go | 4 ++-- Common/parsers/ValidationParser.go | 10 ++++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Common/i18n/messages/flag.go b/Common/i18n/messages/flag.go index 7816ac0..482b7a3 100644 --- a/Common/i18n/messages/flag.go +++ b/Common/i18n/messages/flag.go @@ -35,8 +35,8 @@ var FlagMessages = map[string]map[string]string{ LangEN: "Ports file", }, "flag_scan_mode": { - LangZH: "扫描模式: all, portscan, tcpscan, udpscan, icmp等", - LangEN: "Scan mode: all, portscan, tcpscan, udpscan, icmp, etc.", + LangZH: "扫描模式: all(全部), icmp(存活探测), 或指定插件名称", + LangEN: "Scan mode: all(all plugins), icmp(alive detection), or specific plugin names", }, "flag_thread_num": { LangZH: "端口扫描线程数", diff --git a/Common/parsers/ValidationParser.go b/Common/parsers/ValidationParser.go index 2182536..4bf6e3b 100644 --- a/Common/parsers/ValidationParser.go +++ b/Common/parsers/ValidationParser.go @@ -273,16 +273,18 @@ func (vp *ValidationParser) checkPerformance(input *ValidationInput, config *Par // validateScanMode 验证扫描模式 func (vp *ValidationParser) validateScanMode(scanMode string) error { - validModes := []string{"all", "main", "web", "db", "service", "top1000", "custom", "icmp"} + validModes := []string{"all", "icmp"} + // 检查是否为预定义模式 for _, mode := range validModes { if scanMode == mode { return nil } } - - return NewParseError("VALIDATION_ERROR", - fmt.Sprintf("无效的扫描模式: %s", scanMode), "scan_mode", 0, nil) + + // 允许插件名称作为扫描模式,实际插件验证在运行时进行 + // 这里不做严格验证,避免维护两套插件列表 + return nil }