Files
verify/backend/cmd/packtest/main.go
T
hermes 66056cdfa3 feat(protect): 服务端加壳任务
- internal/protect: PE 注入(改入口 + 内嵌壳 DLL + 双层 CRC32),内嵌 x64/x86 blob 与壳 DLL
- 模型 ProtectTask + 自动迁移
- 路由 /api/v1/dev/protect/tasks: 创建(异步)/列表/详情/下载/删除
- 壳侧新增 device_auto:运行时用 MachineGuid+卷序列号+计算机名算设备指纹
- 单测:资产完整性、cfg 生成、路由注册、产物命名
2026-11-21 13:55:40 +08:00

41 lines
1.0 KiB
Go

// 验证服务端加壳链路:用 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 <src.exe> <out.exe> <cfg.json>")
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)
}
}