// 验证服务端加壳链路:用 protect.Patch 打一个真实 Windows 程序,落盘供 Wine 实测 package main import ( "fmt" "os" "path/filepath" "verification-platform-backend/internal/protect" ) func main() { if len(os.Args) != 4 { fmt.Fprintln(os.Stderr, "用法: packtest ") os.Exit(2) } src, err := os.ReadFile(os.Args[1]) must(err) cfg, err := os.ReadFile(os.Args[3]) must(err) arch, err := protect.DetectArch(src) must(err) fmt.Printf("源: %s 架构: %s %d 字节\n", filepath.Base(os.Args[1]), arch, len(src)) out, info, err := protect.Patch(src, cfg, arch) must(err) must(os.WriteFile(os.Args[2], out, 0o644)) fmt.Printf("产物: %s %d 字节\n", os.Args[2], info.OutSize) fmt.Printf("入口 0x%x → 0x%x .vfy RVA=0x%x size=%d\n", info.EntryOld, info.EntryNew, info.SecRVA, info.SecSize) fmt.Printf("crcVfy=%08x crcFile=%08x\n", info.CrcVfy, info.CrcFile) } func must(err error) { if err != nil { fmt.Fprintln(os.Stderr, "error:", err) os.Exit(1) } }