From 77e59f021c9388bf755069ef16597d97f32bd0e6 Mon Sep 17 00:00:00 2001 From: admin Date: Mon, 23 Nov 2026 19:16:56 +0800 Subject: [PATCH] =?UTF-8?q?feat(protect):=20=E5=8A=A0=20cmd/packthemed?= =?UTF-8?q?=EF=BC=8C=E6=8C=89=20shell=5Ftheme=20=E5=87=BA=E5=90=84?= =?UTF-8?q?=E5=A5=97=E9=AA=8C=E8=AF=81=E7=95=8C=E9=9D=A2=E4=BA=A7=E7=89=A9?= =?UTF-8?q?=EF=BC=88=E6=8B=8D=E7=85=A7/=E5=9B=9E=E5=BD=92=E7=94=A8?= =?UTF-8?q?=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/cmd/packthemed/main.go | 39 ++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 backend/cmd/packthemed/main.go diff --git a/backend/cmd/packthemed/main.go b/backend/cmd/packthemed/main.go new file mode 100644 index 0000000..9d95d37 --- /dev/null +++ b/backend/cmd/packthemed/main.go @@ -0,0 +1,39 @@ +// 按主题打壳:packtest 固定用 classic 壳,这个工具多了 theme 参数,用来出各套验证界面 +// 用法: packthemed +package main + +import ( + "fmt" + "os" + "path/filepath" + + "verification-platform-backend/internal/protect" +) + +func main() { + if len(os.Args) != 5 { + fmt.Fprintln(os.Stderr, "用法: packthemed ") + 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) + theme := protect.NormalizeTheme(os.Args[4]) + + out, info, err := protect.PatchSignedThemed(src, cfg, arch, false, theme) + must(err) + must(os.WriteFile(os.Args[2], out, 0o644)) + + fmt.Printf("%-10s 架构=%s 产物=%s %d 字节 .vfy size=%d\n", + theme, arch, filepath.Base(os.Args[2]), info.OutSize, info.SecSize) +} + +func must(err error) { + if err != nil { + fmt.Fprintln(os.Stderr, "error:", err) + os.Exit(1) + } +}