mirror of
https://github.com/shadow1ng/fscan.git
synced 2025-09-14 14:06:44 +08:00
feat: 在漏洞扫描阶段显示启用的插件列表
增强用户体验,让用户清楚了解漏洞扫描时启用的具体插件: 功能特点: • 在"开始漏洞扫描"后显示实际启用的插件列表 • 智能过滤,只显示针对发现端口的适用插件 • 完整国际化支持,中英文界面均正常显示 • 格式与现有"使用服务插件"保持一致 实现细节: * Core/ServiceScanner.go: 新增LogVulnerabilityPluginInfo函数 - 使用与实际扫描相同的插件过滤逻辑 - 确保显示的插件列表与实际执行的插件一致 - 支持插件去重和格式化显示 * Common/i18n/messages.go: 添加漏洞扫描相关国际化文本 - scan_vulnerability_start: "开始漏洞扫描" / "Starting vulnerability scan" - scan_vulnerability_plugins: "使用漏洞扫描插件: %s" / "Using vulnerability scan plugins: %s" - scan_no_vulnerability_plugins: "未找到可用的漏洞扫描插件" / "No available vulnerability scan plugins found" 显示效果: - 针对SMB端口(445,135): 显示"ms17010, smb, smb2, smbghost, findnet" - 针对Web端口(80,443): 显示"webpoc, webtitle" - 根据实际发现的开放端口智能显示相关插件 提升用户对扫描过程的可见性和控制感,便于调试和性能优化。
This commit is contained in:
parent
291da0c879
commit
69a70fc577
@ -616,10 +616,22 @@ var coreMessages = map[string]map[string]string{
|
|||||||
LangZH: "开始主机扫描",
|
LangZH: "开始主机扫描",
|
||||||
LangEN: "Starting host scan",
|
LangEN: "Starting host scan",
|
||||||
},
|
},
|
||||||
|
"scan_vulnerability_start": {
|
||||||
|
LangZH: "开始漏洞扫描",
|
||||||
|
LangEN: "Starting vulnerability scan",
|
||||||
|
},
|
||||||
"scan_no_service_plugins": {
|
"scan_no_service_plugins": {
|
||||||
LangZH: "未找到可用的服务插件",
|
LangZH: "未找到可用的服务插件",
|
||||||
LangEN: "No available service plugins found",
|
LangEN: "No available service plugins found",
|
||||||
},
|
},
|
||||||
|
"scan_vulnerability_plugins": {
|
||||||
|
LangZH: "使用漏洞扫描插件: %s",
|
||||||
|
LangEN: "Using vulnerability scan plugins: %s",
|
||||||
|
},
|
||||||
|
"scan_no_vulnerability_plugins": {
|
||||||
|
LangZH: "未找到可用的漏洞扫描插件",
|
||||||
|
LangEN: "No available vulnerability scan plugins found",
|
||||||
|
},
|
||||||
"scan_complete_ports_found": {
|
"scan_complete_ports_found": {
|
||||||
LangZH: "扫描完成, 发现 %d 个开放端口",
|
LangZH: "扫描完成, 发现 %d 个开放端口",
|
||||||
LangEN: "Scan completed, found %d open ports",
|
LangEN: "Scan completed, found %d open ports",
|
||||||
|
@ -5,6 +5,7 @@ import (
|
|||||||
"github.com/shadow1ng/fscan/common"
|
"github.com/shadow1ng/fscan/common"
|
||||||
"github.com/shadow1ng/fscan/common/i18n"
|
"github.com/shadow1ng/fscan/common/i18n"
|
||||||
"github.com/shadow1ng/fscan/common/parsers"
|
"github.com/shadow1ng/fscan/common/parsers"
|
||||||
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
)
|
)
|
||||||
@ -78,7 +79,9 @@ func (s *ServiceScanStrategy) performHostScan(hosts []string, info common.HostIn
|
|||||||
|
|
||||||
// 执行漏洞扫描
|
// 执行漏洞扫描
|
||||||
if len(targetInfos) > 0 {
|
if len(targetInfos) > 0 {
|
||||||
common.LogBase("开始漏洞扫描")
|
common.LogBase(i18n.GetText("scan_vulnerability_start"))
|
||||||
|
// 显示即将使用的漏洞扫描插件
|
||||||
|
s.LogVulnerabilityPluginInfo(targetInfos)
|
||||||
ExecuteScanTasks(targetInfos, s, ch, wg)
|
ExecuteScanTasks(targetInfos, s, ch, wg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -198,6 +201,44 @@ func (s *ServiceScanStrategy) LogPluginInfo() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// LogVulnerabilityPluginInfo 输出漏洞扫描插件信息
|
||||||
|
func (s *ServiceScanStrategy) LogVulnerabilityPluginInfo(targets []common.HostInfo) {
|
||||||
|
allPlugins, isCustomMode := s.GetPlugins()
|
||||||
|
|
||||||
|
// 获取实际会被使用的插件列表
|
||||||
|
var vulnerabilityPlugins []string
|
||||||
|
pluginUsed := make(map[string]bool)
|
||||||
|
|
||||||
|
for _, target := range targets {
|
||||||
|
targetPort := 0
|
||||||
|
if target.Ports != "" {
|
||||||
|
targetPort, _ = strconv.Atoi(target.Ports)
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, pluginName := range allPlugins {
|
||||||
|
plugin, exists := common.PluginManager[pluginName]
|
||||||
|
if !exists {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查插件是否适用于当前目标(使用与ExecuteScanTasks相同的逻辑)
|
||||||
|
if s.IsPluginApplicable(plugin, targetPort, isCustomMode) {
|
||||||
|
if !pluginUsed[pluginName] {
|
||||||
|
vulnerabilityPlugins = append(vulnerabilityPlugins, pluginName)
|
||||||
|
pluginUsed[pluginName] = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 输出插件信息
|
||||||
|
if len(vulnerabilityPlugins) > 0 {
|
||||||
|
common.LogBase(fmt.Sprintf(i18n.GetText("scan_vulnerability_plugins"), strings.Join(vulnerabilityPlugins, ", ")))
|
||||||
|
} else {
|
||||||
|
common.LogBase(i18n.GetText("scan_no_vulnerability_plugins"))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// IsPluginApplicable 判断插件是否适用于服务扫描
|
// IsPluginApplicable 判断插件是否适用于服务扫描
|
||||||
func (s *ServiceScanStrategy) IsPluginApplicable(plugin common.ScanPlugin, targetPort int, isCustomMode bool) bool {
|
func (s *ServiceScanStrategy) IsPluginApplicable(plugin common.ScanPlugin, targetPort int, isCustomMode bool) bool {
|
||||||
// 自定义模式下运行所有明确指定的插件
|
// 自定义模式下运行所有明确指定的插件
|
||||||
|
Loading…
Reference in New Issue
Block a user