fix(scan): 修复 -hf 参数无法单独使用的问题

This commit is contained in:
ZacharyZcR
2026-01-23 12:04:23 +08:00
parent 09d2d737ae
commit f49a121424
2 changed files with 6 additions and 4 deletions

View File

@@ -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
}

View File

@@ -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
}