package main import ( "fmt" "os" "time" "github.com/shadow1ng/fscan/common" "github.com/shadow1ng/fscan/core" // 导入统一插件系统 _ "github.com/shadow1ng/fscan/plugins/services" _ "github.com/shadow1ng/fscan/plugins/web" _ "github.com/shadow1ng/fscan/plugins/local" ) func main() { // Linus式简化:直接执行,删除过度工程 // 首先设置开始时间 common.StartTime = time.Now() var info common.HostInfo common.Flag(&info) // 检查核心参数的互斥性:-h、-u、-local 只能指定一个 paramCount := 0 var activeParam string if info.Host != "" { paramCount++ activeParam = "-h" } if common.TargetURL != "" { paramCount++ if activeParam != "" { activeParam += " 和 -u" } else { activeParam = "-u" } } if common.LocalPlugin != "" { paramCount++ if activeParam != "" { activeParam += " 和 -local" } else { activeParam = "-local" } } if paramCount > 1 { fmt.Printf("错误: 参数 %s 互斥,请只指定一个扫描目标\n", activeParam) fmt.Printf(" -h: 网络主机扫描\n") fmt.Printf(" -u: Web URL扫描\n") fmt.Printf(" -local: 本地信息收集\n") os.Exit(1) } // 初始化日志 common.InitLogger() // 解析和验证参数 if err := common.Parse(&info); err != nil { handleError("参数解析失败", err) } // 初始化输出系统 if err := common.InitOutput(); err != nil { handleError("输出初始化失败", err) } defer common.CloseOutput() // 执行扫描 core.RunScan(info) } func handleError(msg string, err error) { common.LogError(fmt.Sprintf("%s: %v", msg, err)) os.Exit(1) }