LogVulnerabilityPluginInfo 输出服务扫描插件信息
(targets []common.HostInfo, config *common.Config)
| 226 | |
| 227 | // LogVulnerabilityPluginInfo 输出服务扫描插件信息 |
| 228 | func (s *ServiceScanStrategy) LogVulnerabilityPluginInfo(targets []common.HostInfo, config *common.Config) { |
| 229 | allPlugins, isCustomMode := s.GetPlugins(config) |
| 230 | |
| 231 | // 获取实际会被使用的插件列表 |
| 232 | servicePluginSet := make(map[string]struct{}, len(allPlugins)) |
| 233 | |
| 234 | for _, pluginName := range allPlugins { |
| 235 | // 使用统一插件系统检查插件存在性 |
| 236 | if !s.pluginExists(pluginName) { |
| 237 | continue |
| 238 | } |
| 239 | |
| 240 | // 检查插件是否通过过滤器类型检查 |
| 241 | if !s.isPluginPassesFilterType(pluginName, isCustomMode, config) { |
| 242 | continue |
| 243 | } |
| 244 | |
| 245 | // 检查插件是否适用于任意一个目标 |
| 246 | for _, target := range targets { |
| 247 | if target.Port == 0 { |
| 248 | continue |
| 249 | } |
| 250 | |
| 251 | // 使用 host:port 信息检查插件适用性(Web插件需要host信息) |
| 252 | if s.isPluginApplicableToPortWithHost(pluginName, target.Host, target.Port) { |
| 253 | servicePluginSet[pluginName] = struct{}{} |
| 254 | break // 只要适用于一个目标就添加 |
| 255 | } |
| 256 | } |
| 257 | } |
| 258 | |
| 259 | // 转换为切片 |
| 260 | var servicePlugins []string |
| 261 | for pluginName := range servicePluginSet { |
| 262 | servicePlugins = append(servicePlugins, pluginName) |
| 263 | } |
| 264 | |
| 265 | // 输出插件信息 |
| 266 | if len(servicePlugins) > 0 { |
| 267 | common.LogInfo(i18n.Tr("service_plugin_info", strings.Join(servicePlugins, ", "))) |
| 268 | } else { |
| 269 | common.LogInfo(i18n.GetText("scan_no_service_plugins")) |
| 270 | } |
| 271 | } |
| 272 | |
| 273 | // ============================================================================= |
| 274 | // 端口发现功能(从 PortDiscoveryService 合并) |
nothing calls this directly
no test coverage detected