refactor: 调整逻辑,修复SMB2的一个跳出问题

This commit is contained in:
ZacharyZcR
2025-01-04 17:00:03 +08:00
parent af06345aa5
commit 235e2aee60
6 changed files with 56 additions and 43 deletions

View File

@@ -901,6 +901,8 @@ var (
HttpProxy string // 原Proxy
Socks5Proxy string
LocalMode bool // -local 本地模式
// POC配置
PocPath string
Pocinfo PocInfo

View File

@@ -215,6 +215,9 @@ func Flag(Info *HostInfo) {
flag.StringVar(&HttpProxy, "proxy", "", "设置HTTP代理服务器")
flag.StringVar(&Socks5Proxy, "socks5", "", "设置Socks5代理(用于TCP连接,将影响超时设置)")
// 本地扫描配置
flag.BoolVar(&LocalMode, "local", false, "启用本地信息收集模式")
// POC配置
flag.StringVar(&PocPath, "pocpath", "", "指定自定义POC文件路径")
flag.StringVar(&Pocinfo.PocName, "pocname", "", "指定要使用的POC名称,如: -pocname weblogic")

View File

@@ -3,6 +3,7 @@ package Common
import (
"bufio"
"encoding/hex"
"flag"
"fmt"
"net/url"
"os"
@@ -204,12 +205,27 @@ func Readfile(filename string) ([]string, error) {
// ParseInput 解析和验证输入参数配置
func ParseInput(Info *HostInfo) error {
// 所有目标参数为空时表示本地扫描模式
if Info.Host == "" && HostsFile == "" && TargetURL == "" && URLsFile == "" {
LogInfo("未指定扫描目标,将以本地模式运行")
// 检查互斥的扫描模式
modes := 0
if Info.Host != "" || HostsFile != "" {
modes++
}
if TargetURL != "" || URLsFile != "" {
modes++
}
if LocalMode {
modes++
}
// 配置基本参数
if modes == 0 {
// 无参数时显示帮助
flag.Usage()
return fmt.Errorf("请指定扫描参数")
} else if modes > 1 {
return fmt.Errorf("参数 -h、-u、-local 不能同时使用")
}
// 处理爆破线程配置
if BruteThreads <= 0 {
BruteThreads = 1
LogInfo(fmt.Sprintf("暴力破解线程数: %d", BruteThreads))