7 Commits
Author SHA1 Message Date
Cmake 40763b270a tools(dogkeygen): 加宿主侧自验签演示 verify_demo.c
验签逻辑(base64 → BN_mod_exp → PKCS#1 解析 → chunk + SHA-1 校验)放在 DogProtectBegin/End
标记里,实测评测:未加壳与加壳后都能正确接受 dogkeygen 签发的序列号、拒绝被改坏的序列号。
这条路不依赖 SDK 的授权 API,也就不依赖打包器注入的 runtime 与 _so_code 元数据。
2026-11-23 18:00:12 +08:00
Cmake c04836fd49 runtime: 让 runtime 在 Linux 上可构建 + 资源打包脚本
- runtime/precompiled.h: sys/sysctl.h 只在 __APPLE__ 引入;补 <cstdarg>
- runtime/lin_runtime.mak: curl 改为 -lcurl + pkg-config(原来是写死 ~/curl-7.35.0-64)
- core/gen_inc_lin.py: 把 lin_runtime.so 打成 lin_runtimeNN.so.inc(key + 位置异或,格式对齐
  IFile::OpenResource(is_enc=true)),_so_code 写空表
- runtime/licensing_manager.cc: SetSerialNumber 加 DOGDBG=1 才输出的 [dbrt] 跟踪
- tools/dogkeygen/testhost_lin.c: Linux 侧 SDK 调用测试宿主
- BUILD-LINUX.md: 补 runtime 构建与 .inc 格式说明(含 _so_code 缺失导致授权调用被打桩的结论)
2026-11-23 17:38:12 +08:00
Cmake 29c643e032 tools(dogkeygen): 增加 --serial-version(1/2),README 补选项说明 2026-11-23 17:25:57 +08:00
Cmake b9833d578b build(linux): 清理 lin_common.mak 里重复的 ULTIMATE 注释块 2026-11-23 17:23:14 +08:00
Cmake 3e6d740de5 dogprotect: 恢复随机节名、兼容旧 SDK 名、换狗头图标、加 keygen
- core/core.cc: VM 代码节名恢复为随机 ".<3字符>"(上游行为),不再是固定 .dog
- 旧名兼容:core/files.cc 新增 IsLegacySDKLibraryName() / NormalizeSDKFunctionName(),
  pefile/intel/elffile/macfile 的库名匹配同时认 vmprotectsdk{32,64}.dll、vmprotectddk*.sys、
  libvmprotectsdk*.so、libvmprotectsdk.dylib;dotnetfile 认旧托管程序集 VMProtect.SDK
  与 VMProtect.* 命名空间
- 图标:core/main.ico、core/vmp.ico、core/help.ico、DogProtect/images/{logo,help_icon}.png、
  app/dogprotect_gui.app/Contents/Resources/logo.icns 全部换成狗头(多尺寸原生渲染 + 预乘 alpha 缩放)
- lin_common.mak: Linux 目标追加 -DULTIMATE(授权子系统只在 ULTIMATE 分支编译)
- tools/dogkeygen: 序列号生成器(自带 bignum/SHA-1/base64,PKCS#1 v1.5 签名)+ testhost.c +
  vmpsdk64.def + README
- BUILD-LINUX.md: 删掉改名说明,补授权与构建要点
2026-11-23 17:22:49 +08:00
Cmake 7ee2826040 dogprotect: VMProtect → DogProtect 全量改名 + VM 节名改 .dog
与 dogprotect / linux-build 分支同一次改名,等价内容:
- 产品名/展示串、SDK 与运行时导出 API、.NET 命名空间全部换为 DogProtect
- 文件名与目录改名(dogprotect.sln / DogProtect/ / DogProtectCon/ / sdk/DogProtect.SDK/ /
  sdk/DogProtectSDK.{h,pas,bas,inc} / runtime/DogProtect.Runtime/ / core/dogprotect.rc /
  app/dogprotect_gui.app)
- 项目文件扩展名 .vmp → .dog;VM 代码节名默认 .dog(产物节 .dog0/.dog1/...)
- 授权数据/配置: DogProtect.dat、DogProtectLicense.ini、Global\\DogProtect.dat
- 域名占位 dogprotect.example、bundle id com.dogprotect.dogprotect
- 保留 VMP_* 内部宏与 third-party/
2026-11-23 16:16:12 +08:00
Cmake 14057ed1db strip: 移除原始厂商版权信息
- core/core.h: Core::copyright() 返回空串(保留函数,调用方不变)
- VMProtectCon/main.cc: 横幅有版权串才拼接,空则只打版本
- VMProtect/about_dialog.cc: 版权文本为空时隐藏该 QLabel
- minidumpfixer/main.cpp: 去掉横幅里的厂商版权
- core/vmprotect.rc、shellext/shellext.rc: CompanyName / LegalCopyright 置空
  (ProductName、OriginalFilename 保持不变,属产品标识非版权)
- help/en、help/ru 共 150 个页面: 去掉页脚 \xA9 2006-2015 Copyright VMProtect Software
- core/VMProtectLicense.ini: 测试授权里的厂商用户名/邮箱换成本地占位值
- .NET AssemblyInfo(5 处) 与 utils/x86disasm: 去掉无主版权串
2026-11-23 16:02:09 +08:00
10 changed files with 19 additions and 45 deletions
+2 -4
View File
@@ -8,11 +8,9 @@ TMP_ARCH_DIR := ../tmp/lin/console/$(ARCH_DIR)
TMP_DIR := $(TMP_ARCH_DIR)/$(CFG_DIR)/$(PROJECT) TMP_DIR := $(TMP_ARCH_DIR)/$(CFG_DIR)/$(PROJECT)
PCH_DIR := $(TMP_DIR)/$(PROJECT).gch PCH_DIR := $(TMP_DIR)/$(PROJECT).gch
DEFINES := $(CONFIG) -DTIXML_USE_STL DEFINES := $(CONFIG) -DTIXML_USE_STL
LFLAGS := -Wl,-rpath,\$$ORIGIN -no-pie -Wl,--allow-multiple-definition LFLAGS := -Wl,-rpath,\$$ORIGIN
LIBS := $(SDK_LIBS) -Wl,--no-as-needed -L../bin -lDogProtectSDK$(ARCH_DIR) -ldl -Wl,--as-needed LIBS := $(SDK_LIBS) -Wl,--no-as-needed -L../bin -lDogProtectSDK$(ARCH_DIR) -ldl -Wl,--as-needed
# Linux: static libcrypto.a drags in zlib/zstd; use the shared libs instead. OBJCOMP := ../bin/$(ARCH_DIR)/$(CFG_DIR)/core.a ../bin/$(ARCH_DIR)/invariant_core.a ../third-party/libffi/libffi$(ARCH_DIR).a /usr/lib/$(ARCH)/libcrypto.a
# Prebuilt libffi is non-PIE, hence -no-pie above.
OBJCOMP := ../bin/$(ARCH_DIR)/$(CFG_DIR)/core.a ../bin/$(ARCH_DIR)/invariant_core.a ../third-party/libffi/libffi$(ARCH_DIR).a -lcrypto -lz
DYLIBS := DYLIBS :=
PCH_DIR := $(TMP_DIR) PCH_DIR := $(TMP_DIR)
+6 -12
View File
@@ -1700,11 +1700,7 @@ bool Core::Compile()
#endif #endif
rand_seed = 0; rand_seed = 0;
#ifdef _WIN32
OutputDebugStringA(string_format("rand_seed:%d\n", rand_seed).c_str()); OutputDebugStringA(string_format("rand_seed:%d\n", rand_seed).c_str());
#else
(void)rand_seed;
#endif
srand(rand_seed); srand(rand_seed);
@@ -3223,14 +3219,12 @@ bool RSA::CreateKeyPair(size_t key_length)
delete modulus_; delete modulus_;
bool bInv = false; bool bInv = false;
uint8_t *data = new uint8_t[key_length / 8 + 1]; uint8_t *data = new uint8_t[key_length / 8 + 1];
const OpenSSL::BIGNUM *rn = NULL, *re = NULL, *rd = NULL; OpenSSL::BN_bn2bin(r->n, data);
OpenSSL::RSA_get0_key(r, &rn, &re, &rd); modulus_ = new BigNumber(data, BN_num_bytes(r->n), bInv);
OpenSSL::BN_bn2bin(rn, data); OpenSSL::BN_bn2bin(r->e, data);
modulus_ = new BigNumber(data, BN_num_bytes(rn), bInv); public_exp_ = new BigNumber(data, BN_num_bytes(r->e), bInv);
OpenSSL::BN_bn2bin(re, data); OpenSSL::BN_bn2bin(r->d, data);
public_exp_ = new BigNumber(data, BN_num_bytes(re), bInv); private_exp_ = new BigNumber(data, BN_num_bytes(r->d), bInv);
OpenSSL::BN_bn2bin(rd, data);
private_exp_ = new BigNumber(data, BN_num_bytes(rd), bInv);
delete data; delete data;
res = true; res = true;
} }
-4
View File
@@ -15,11 +15,7 @@
#include "packer.h" #include "packer.h"
#include "intel.h" #include "intel.h"
#include "objc.h" #include "objc.h"
#ifdef _WIN32
#include <intrin.h> #include <intrin.h>
#else
#include <x86intrin.h>
#endif
/** /**
* IntelCommand * IntelCommand
-1
View File
@@ -3,7 +3,6 @@
*/ */
#include "objects.h" #include "objects.h"
#include <cstdarg>
#ifdef __APPLE__ #ifdef __APPLE__
#define _vsnprintf_s(dest, dest_sz, cnt, fmt, args) _vsnprintf((dest), (dest_sz), (fmt), (args)) #define _vsnprintf_s(dest, dest_sz, cnt, fmt, args) _vsnprintf((dest), (dest_sz), (fmt), (args))
+4 -4
View File
@@ -3163,7 +3163,7 @@ void PERuntimeFunctionList::ReadFromFile(PEArchitecture &file, PEDirectory &dire
std::vector<uint8_t> call_frame_instructions; std::vector<uint8_t> call_frame_instructions;
for (size_t i = 0; i < directory.size(); i += sizeof(data)) { for (size_t i = 0; i < directory.size(); i += sizeof(data)) {
file.Read(&data, sizeof(data)); file.Read(&data, sizeof(data));
Add(address_ + i, data.BeginAddress + image_base, data.EndAddress + image_base, data.UnwindInfoAddress + image_base, 0, call_frame_instructions); Add(address_ + i, data.BeginAddress + image_base, data.EndAddress + image_base, data.u.UnwindData + image_base, 0, call_frame_instructions);
} }
} }
@@ -3178,7 +3178,7 @@ size_t PERuntimeFunctionList::WriteToFile(PEArchitecture &file)
PERuntimeFunction *runtime_function = item(i); PERuntimeFunction *runtime_function = item(i);
data.BeginAddress = static_cast<uint32_t>(runtime_function->begin() - image_base); data.BeginAddress = static_cast<uint32_t>(runtime_function->begin() - image_base);
data.EndAddress = static_cast<uint32_t>(runtime_function->end() - image_base); data.EndAddress = static_cast<uint32_t>(runtime_function->end() - image_base);
data.UnwindInfoAddress = static_cast<uint32_t>(runtime_function->unwind_address() - image_base); data.u.UnwindData = static_cast<uint32_t>(runtime_function->unwind_address() - image_base);
res += file.Write(&data, sizeof(data)); res += file.Write(&data, sizeof(data));
} }
@@ -3405,7 +3405,7 @@ void PETLSDirectory::ReadFromFile(PEArchitecture &file, PEDirectory &directory)
address_of_index_ = tls.AddressOfIndex; address_of_index_ = tls.AddressOfIndex;
address_of_call_backs_ = tls.AddressOfCallBacks; address_of_call_backs_ = tls.AddressOfCallBacks;
size_of_zero_fill_ = tls.SizeOfZeroFill; size_of_zero_fill_ = tls.SizeOfZeroFill;
characteristics_ = tls.Characteristics; characteristics_ = tls.u.Characteristics;
} else { } else {
IMAGE_TLS_DIRECTORY64 tls; IMAGE_TLS_DIRECTORY64 tls;
file.Read(&tls, sizeof(tls)); file.Read(&tls, sizeof(tls));
@@ -3414,7 +3414,7 @@ void PETLSDirectory::ReadFromFile(PEArchitecture &file, PEDirectory &directory)
address_of_index_ = tls.AddressOfIndex; address_of_index_ = tls.AddressOfIndex;
address_of_call_backs_ = tls.AddressOfCallBacks; address_of_call_backs_ = tls.AddressOfCallBacks;
size_of_zero_fill_ = tls.SizeOfZeroFill; size_of_zero_fill_ = tls.SizeOfZeroFill;
characteristics_ = tls.Characteristics; characteristics_ = tls.u.Characteristics;
} }
if (!address_of_call_backs_) if (!address_of_call_backs_)
-3
View File
@@ -3,7 +3,6 @@
#define CORE_PCH #define CORE_PCH
#include "../runtime/precommon.h" #include "../runtime/precommon.h"
#include <cstdarg>
#include <vector> #include <vector>
#include <list> #include <list>
#include <iostream> #include <iostream>
@@ -39,9 +38,7 @@
#endif #endif
#endif #endif
#include <sys/mman.h> #include <sys/mman.h>
#ifdef __APPLE__
#include <sys/sysctl.h> #include <sys/sysctl.h>
#endif
#define DUMMYUNIONNAME u #define DUMMYUNIONNAME u
#define DUMMYUNIONNAME2 u2 #define DUMMYUNIONNAME2 u2
-4
View File
@@ -6,11 +6,7 @@
#include "core.h" #include "core.h"
#include "processors.h" #include "processors.h"
#include "lang.h" #include "lang.h"
#ifdef _WIN32
#include <intrin.h> #include <intrin.h>
#else
#include <x86intrin.h>
#endif
/** /**
* AddressRange * AddressRange
+6 -7
View File
@@ -1,7 +1,6 @@
#WARN: no incremental build supported yet (use 'all' target carefully) #WARN: no incremental build supported yet (use 'all' target carefully)
.PHONY: clean all rebuild .PHONY: clean all rebuild
.DEFAULT_GOAL := all
BIN_TARGET := $(BIN_DIR)/$(TARGET) BIN_TARGET := $(BIN_DIR)/$(TARGET)
@@ -10,11 +9,11 @@ CXX := clang++
LINK := clang++ LINK := clang++
CFLAGS := $(CFLAGS) -pipe -fvisibility=hidden -DNDEBUG -O3 -gdwarf-2 -target $(ARCH) -Wall -W -fPIC $(DEFINES) CFLAGS := $(CFLAGS) -pipe -fvisibility=hidden -DNDEBUG -O3 -gdwarf-2 -target $(ARCH) -Wall -W -fPIC $(DEFINES)
CXXFLAGS := $(CXXFLAGS) $(CFLAGS) -std=c++11 -fvisibility-inlines-hidden -fno-stack-protector -fno-builtin -Wno-reorder -Wno-switch -Wno-unused-parameter -Wno-unused-variable CXXFLAGS := $(CXXFLAGS) $(CFLAGS) -std=c++11 -fvisibility-inlines-hidden -fno-stack-protector -fno-builtin -Wno-reorder -Wno-switch -Wno-unused-parameter -Wno-unused-variable
# Linux 目标统一按 Ultimate 版编译:授权/序列号子系统(LicensingManager、-lf 授权参数文件、 # Linux 目标按 Ultimate 版编译:授权子系统只在 ULTIMATE 分支里编译,
# 密钥对与密钥库)只在 ULTIMATE 分支里编译,其余版本打包时会报 # 否则打包时报 "The licensing system not supported in this version"。
# "The licensing system not supported in this version"。追加而不是改 $(DEFINES),避免覆盖各目标的宏。 # 用 += 追加,别改 $(DEFINES),否则会覆盖各目标自带的宏。
CFLAGS += -DULTIMATE CFLAGS += -DULTIMATE
CXXFLAGS += -DULTIMATE CXXFLAGS += -DULTIMATE
LFLAGS := $(LFLAGS) -Wl,--as-needed -std=c++11 -target $(ARCH) LFLAGS := $(LFLAGS) -Wl,--as-needed -std=c++11 -target $(ARCH)
SDK_LIBS := SDK_LIBS :=
+1 -2
View File
@@ -72,7 +72,7 @@ inline uint64_t _rotr64(uint64_t value, int shift)
return (value >> shift) | (value << (sizeof(value) * 8 - shift)); return (value >> shift) | (value << (sizeof(value) * 8 - shift));
} }
inline uint64_t vmp_rdtsc() inline uint64_t __rdtsc()
{ {
uint32_t hi, lo; uint32_t hi, lo;
__asm__ __volatile__ ("rdtsc" __asm__ __volatile__ ("rdtsc"
@@ -80,7 +80,6 @@ inline uint64_t vmp_rdtsc()
); );
return static_cast<uint64_t>(lo) | static_cast<uint64_t>(hi) << 32; return static_cast<uint64_t>(lo) | static_cast<uint64_t>(hi) << 32;
} }
#define __rdtsc() vmp_rdtsc()
inline void __cpuid(int regs[4], uint32_t value) inline void __cpuid(int regs[4], uint32_t value)
-4
View File
@@ -106,11 +106,7 @@ typedef int (FAR WINAPI *FARPROC)();
#else #else
#include <windows.h> #include <windows.h>
#include <iphlpapi.h> #include <iphlpapi.h>
#ifdef _WIN32
#include <intrin.h> #include <intrin.h>
#else
#include <x86intrin.h>
#endif
#include <wtsapi32.h> #include <wtsapi32.h>
#include <winternl.h> #include <winternl.h>
#include <tlhelp32.h> #include <tlhelp32.h>