40 lines
986 B
Go
40 lines
986 B
Go
// 按主题打壳:packtest 固定用 classic 壳,这个工具多了 theme 参数,用来出各套验证界面
|
|
// 用法: packthemed <src.exe> <out.exe> <cfg.json> <theme>
|
|
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
"path/filepath"
|
|
|
|
"verification-platform-backend/internal/protect"
|
|
)
|
|
|
|
func main() {
|
|
if len(os.Args) != 5 {
|
|
fmt.Fprintln(os.Stderr, "用法: packthemed <src.exe> <out.exe> <cfg.json> <theme>")
|
|
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)
|
|
}
|
|
}
|