From f49a121424abb82734d327f314c07a92898ac4b6 Mon Sep 17 00:00:00 2001 From: ZacharyZcR Date: Fri, 23 Jan 2026 12:04:23 +0800 Subject: [PATCH] =?UTF-8?q?fix(scan):=20=E4=BF=AE=E5=A4=8D=20-hf=20?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E6=97=A0=E6=B3=95=E5=8D=95=E7=8B=AC=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/alive_scanner.go | 5 +++-- core/service_scanner.go | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/core/alive_scanner.go b/core/alive_scanner.go index 33598bb..a5faa24 100644 --- a/core/alive_scanner.go +++ b/core/alive_scanner.go @@ -54,8 +54,9 @@ func (s *AliveScanStrategy) Description() string { // Execute 执行存活探测扫描策略 func (s *AliveScanStrategy) Execute(config *common.Config, state *common.State, info common.HostInfo, ch chan struct{}, wg *sync.WaitGroup) { - // 验证扫描目标 - if info.Host == "" { + // 验证扫描目标(需要同时检查 -h 和 -hf 参数) + fv := common.GetFlagVars() + if info.Host == "" && fv.HostsFile == "" { common.LogError(i18n.GetText("parse_error_target_empty")) return } diff --git a/core/service_scanner.go b/core/service_scanner.go index c73c320..67d2eac 100644 --- a/core/service_scanner.go +++ b/core/service_scanner.go @@ -113,8 +113,9 @@ func (s *ServiceScanStrategy) Description() string { // Execute 执行服务扫描策略 func (s *ServiceScanStrategy) Execute(config *common.Config, state *common.State, info common.HostInfo, ch chan struct{}, wg *sync.WaitGroup) { - // 验证扫描目标 - if info.Host == "" { + // 验证扫描目标(需要同时检查 -h 和 -hf 参数) + fv := common.GetFlagVars() + if info.Host == "" && fv.HostsFile == "" { common.LogError(i18n.GetText("parse_error_target_empty")) return }