fix: Web扫描的Bug

This commit is contained in:
ZacharyZcR 2025-02-14 18:50:19 +08:00
parent 46e0472ec1
commit 18aae783c6
3 changed files with 8 additions and 5 deletions

View File

@ -40,7 +40,7 @@ var PluginGroups = map[string][]string{
"ms17010", "smbghost", "smb2", "ms17010", "smbghost", "smb2",
}, },
ModeLocal: { ModeLocal: {
"localinfo", "localinfo", "minidump", "dcinfo",
}, },
} }

View File

@ -1100,7 +1100,7 @@ var i18nMap = map[string]map[string]string{
} }
// 当前语言设置 // 当前语言设置
var currentLang = LangJA var currentLang = LangZH
func SetLanguage() { func SetLanguage() {
// 使用flag设置的语言 // 使用flag设置的语言

View File

@ -35,9 +35,11 @@ func Scan(info Common.HostInfo) {
switch { switch {
case Common.LocalMode: case Common.LocalMode:
// 本地信息收集模式 // 本地信息收集模式
LocalScan = true
executeLocalScan(info, &ch, &wg) executeLocalScan(info, &ch, &wg)
case len(Common.URLs) > 0: case len(Common.URLs) > 0:
// Web扫描模式 // Web扫描模式
WebScan = true
executeWebScan(info, &ch, &wg) executeWebScan(info, &ch, &wg)
default: default:
// 主机扫描模式 // 主机扫描模式
@ -67,6 +69,7 @@ func executeLocalScan(info Common.HostInfo, ch *chan struct{}, wg *sync.WaitGrou
// 输出使用的插件信息 // 输出使用的插件信息
if Common.ScanMode == Common.ModeLocal { if Common.ScanMode == Common.ModeLocal {
Common.LogInfo("使用全部本地插件") Common.LogInfo("使用全部本地插件")
Common.ParseScanMode(Common.ScanMode)
} else { } else {
Common.LogInfo(fmt.Sprintf("使用插件: %s", Common.ScanMode)) Common.LogInfo(fmt.Sprintf("使用插件: %s", Common.ScanMode))
} }
@ -106,6 +109,7 @@ func executeWebScan(info Common.HostInfo, ch *chan struct{}, wg *sync.WaitGroup)
// 输出使用的插件信息 // 输出使用的插件信息
if Common.ScanMode == Common.ModeWeb { if Common.ScanMode == Common.ModeWeb {
Common.LogInfo("使用全部Web插件") Common.LogInfo("使用全部Web插件")
Common.ParseScanMode(Common.ScanMode)
} else { } else {
Common.LogInfo(fmt.Sprintf("使用插件: %s", Common.ScanMode)) Common.LogInfo(fmt.Sprintf("使用插件: %s", Common.ScanMode))
} }
@ -208,7 +212,7 @@ func shouldPingScan(hosts []string) bool {
// 返回: 存活端口列表 // 返回: 存活端口列表
func getAlivePorts(hosts []string) []string { func getAlivePorts(hosts []string) []string {
var alivePorts []string var alivePorts []string
// 根据扫描模式选择端口扫描方式 // 根据扫描模式选择端口扫描方式
if Common.IsWebScan() { if Common.IsWebScan() {
alivePorts = NoPortScan(hosts, Common.Ports) alivePorts = NoPortScan(hosts, Common.Ports)
@ -266,7 +270,7 @@ func prepareTargetInfos(alivePorts []string, baseInfo Common.HostInfo) []Common.
// ScanTask 扫描任务结构体 // ScanTask 扫描任务结构体
type ScanTask struct { type ScanTask struct {
pluginName string // 插件名称 pluginName string // 插件名称
target Common.HostInfo // 目标信息 target Common.HostInfo // 目标信息
} }
@ -292,7 +296,6 @@ func executeScans(targets []Common.HostInfo, ch *chan struct{}, wg *sync.WaitGro
if !exists { if !exists {
continue continue
} }
taskAdded, newTasks := collectScanTasks(plugin, target, targetPort, pluginName, isSinglePlugin) taskAdded, newTasks := collectScanTasks(plugin, target, targetPort, pluginName, isSinglePlugin)
if taskAdded { if taskAdded {
actualTasks += len(newTasks) actualTasks += len(newTasks)