From eb1b0f32a61316892c1008aaeb7cc3d16719e0d6 Mon Sep 17 00:00:00 2001 From: ZacharyZcR <2903735704@qq.com> Date: Sun, 22 Dec 2024 02:58:55 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E9=87=8D=E6=9E=84=E6=89=AB?= =?UTF-8?q?=E6=8F=8F=E6=A8=A1=E5=BC=8F=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Core/Scanner.go | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Core/Scanner.go b/Core/Scanner.go index 0c059da..9ae8d8a 100644 --- a/Core/Scanner.go +++ b/Core/Scanner.go @@ -110,14 +110,16 @@ func prepareTargetInfos(alivePorts []string, baseInfo Common.HostInfo) []Common. func executeScans(targets []Common.HostInfo, ch *chan struct{}, wg *sync.WaitGroup) { mode := Common.GetScanMode() var pluginsToRun []string + isSinglePlugin := false // 获取要执行的插件列表 if plugins := Common.GetPluginsForMode(mode); plugins != nil { // 预设模式下使用配置的插件组 pluginsToRun = plugins } else { - // 单插件模式下只包含指定的插件 + // 单插件模式 pluginsToRun = []string{mode} + isSinglePlugin = true } // 统一处理所有目标和插件 @@ -133,14 +135,19 @@ func executeScans(targets []Common.HostInfo, ch *chan struct{}, wg *sync.WaitGro // 本地扫描模式的特殊处理 if Common.LocalScan { - // 只执行没有端口配置的插件 if len(plugin.Ports) == 0 { AddScan(pluginName, target, ch, wg) } continue } - // 非本地扫描模式的常规处理 + // 单插件模式直接执行,不检查端口 + if isSinglePlugin { + AddScan(pluginName, target, ch, wg) + continue + } + + // 预设模式下的常规处理 if len(plugin.Ports) > 0 { if plugin.HasPort(targetPort) { AddScan(pluginName, target, ch, wg)