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 }