Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7c7d11371b | ||
|
|
64b374fa06 | ||
|
|
e3daf90ba3 | ||
|
|
fa677beeed | ||
|
|
195f02a41d |
@@ -2,3 +2,9 @@
|
||||
/tmp/
|
||||
*.o
|
||||
*.gch
|
||||
/tools/dogkeygen/dogkeygen
|
||||
/tools/dogkeygen/dogkeygen.exe
|
||||
/tools/dogkeygen/*.a
|
||||
/tools/dogkeygen/*.exe
|
||||
/tools/dogkeygen/testhost_lin
|
||||
/tools/dogkeygen/testhost_lin.exe
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# 在 Linux 上编译 VMProtect(Console / Core / SDK / Runtime)
|
||||
# 在 Linux 上编译 DogProtect(Console / Core / SDK / Runtime)
|
||||
|
||||
本文件记录在 **Debian 13 + clang 19** 上把本仓库的 Linux 目标(`-target x86_64-linux-gnu`)编译通过所需的最小改动。
|
||||
所有改动已在 `linux-build` 分支上,直接按下面顺序构建即可,不再需要手工补参数。
|
||||
@@ -16,22 +16,22 @@ apt-get install -y clang make libssl-dev zlib1g-dev
|
||||
```bash
|
||||
cd core/invariant && make -f lin_invariant_core64.mak CFG_DIR=release # → bin/64/invariant_core.a
|
||||
cd ../../core && make -f lin_core64.mak CFG_DIR=release # → bin/64/release/core.a(约 70MB)
|
||||
cd ../sdk && make -f lin_sdk64.mak CFG_DIR=release # → bin/libVMProtectSDK64.so
|
||||
cd ../VMProtectCon && make -f lin_console64.mak CFG_DIR=release # → bin/64/release/vmprotect_con
|
||||
cd ../sdk && make -f lin_sdk64.mak CFG_DIR=release # → bin/libDogProtectSDK64.so
|
||||
cd ../DogProtectCon && make -f lin_console64.mak CFG_DIR=release # → bin/64/release/dogprotect_con
|
||||
```
|
||||
|
||||
运行:
|
||||
|
||||
```bash
|
||||
LD_LIBRARY_PATH=$PWD/bin ./bin/64/release/vmprotect_con
|
||||
# VMProtect Professional v 3.5.1 (build 1024)
|
||||
# Usage: vmprotect_con File [Output File] [-pf Project File] [-sf Script File] [-wm Watermark] [-we]
|
||||
LD_LIBRARY_PATH=$PWD/bin ./bin/64/release/dogprotect_con
|
||||
# DogProtect Professional v 3.5.1 (build 1024)
|
||||
# Usage: dogprotect_con File [Output File] [-pf Project File] [-sf Script File] [-wm Watermark] [-we]
|
||||
```
|
||||
|
||||
加壳(一份 CLI 同时吃 PE / ELF / Mach-O,取决于是哪种文件):
|
||||
|
||||
```bash
|
||||
/vmprotect_con input.bin output.bin [-pf project.vmp] [-sf script.lua]
|
||||
/dogprotect_con input.bin output.bin [-pf project.dog] [-sf script.lua]
|
||||
```
|
||||
|
||||
## 为 Linux 编译修掉的 10 个问题
|
||||
@@ -47,7 +47,7 @@ LD_LIBRARY_PATH=$PWD/bin ./bin/64/release/vmprotect_con
|
||||
| 7 | `core/objects.cc` | 用了 `va_start/va_end` 但缺 `<cstdarg>` | 补 include(PCH 里也补一份) |
|
||||
| 8 | `core/pefile.cc` | MSVC union 写法 `data.u.UnwindData` / `tls.u.Characteristics` | 改成 `data.UnwindInfoAddress` / `tls.Characteristics` |
|
||||
| 9 | 各 `*.mak` | 默认目标指向 `clean`,`make -f xxx.mak` 会清空产物 | `lin_common.mak` 加 `.DEFAULT_GOAL := all` |
|
||||
| 10 | `VMProtectCon/lin_console.mak` | 链接静态 `libcrypto.a` 牵出 zlib/zstd;预编译 libffi 是非 PIE;`strlcpy` 与 glibc 2.38+ 重名 | 改 `-lcrypto -lz`、加 `-no-pie`、加 `-Wl,--allow-multiple-definition` |
|
||||
| 10 | `DogProtectCon/lin_console.mak` | 链接静态 `libcrypto.a` 牵出 zlib/zstd;预编译 libffi 是非 PIE;`strlcpy` 与 glibc 2.38+ 重名 | 改 `-lcrypto -lz`、加 `-no-pie`、加 `-Wl,--allow-multiple-definition` |
|
||||
|
||||
## 已验证的能力边界(源码写死,非配置)
|
||||
|
||||
@@ -56,15 +56,46 @@ LD_LIBRARY_PATH=$PWD/bin ./bin/64/release/vmprotect_con
|
||||
- **PE**:x86 / x64,含 .NET(`core/dotnetfile.cc`)
|
||||
- **不支持**:ARM / AArch64、Android APK/DEX、iOS arm64
|
||||
|
||||
## 授权提示(重要)
|
||||
|
||||
本仓库是商业软件的源码副本。`vmprotect_con` 在**未注册**状态下打出的产物,运行时会直接报:
|
||||
## Runtime(注入到产物里的那部分代码)
|
||||
|
||||
```
|
||||
This application is protected with unregistered version of VMProtect
|
||||
and cannot be executed on this computer.
|
||||
`runtime/` 现在也能在 Linux 上构建(原来是 Windows 专用,没人动过):
|
||||
|
||||
```bash
|
||||
apt-get install -y libcurl4-openssl-dev # runtime/licensing_manager.cc 的激活接口要 curl
|
||||
cd runtime && make -f lin_runtime64.mak -j$(nproc) # → bin/64/Release/lin_runtime.so
|
||||
python3 core/gen_inc_lin.py bin/64/Release/lin_runtime.so core/lin_runtime64.so.inc lin_runtime64
|
||||
cd core && make -f lin_core64.mak CFG_DIR=release # 把新 blob 编进打包器
|
||||
```
|
||||
|
||||
也就是说:**流程能跑通,产物不能用于交付**。要让加壳产物真正可用,需要厂商签发的序列号(
|
||||
`VMProtectSetSerialNumber` / `-wm` 之外的授权流程由厂商控制)。使用前请确认你拥有对应授权,
|
||||
本文件只覆盖「让它在这台 Linux 上编译并跑起来」,不涉及授权校验。
|
||||
修掉的三处(都在 `runtime/`):
|
||||
|
||||
| 文件 | 问题 | 处理 |
|
||||
|---|---|---|
|
||||
| `precompiled.h` | 无条件 `#include <sys/sysctl.h>`(macOS 头) | 用 `#ifdef __APPLE__` 包住 |
|
||||
| `precompiled.h` | 用了 `va_copy/va_end` 但缺 `<cstdarg>` | 补 include |
|
||||
| `lin_runtime.mak` | 链接写死 `~/curl-7.35.0-64/lib/libcurl.so` 与对应 include | 改 `-lcurl` + `pkg-config --cflags libcurl` |
|
||||
|
||||
`core/*_runtime*.inc` 的格式(`IFile::OpenResource(..., is_enc=true)`):
|
||||
|
||||
- `_so_file[]` = 4 字节 key(小端)+ 整份 .so 按位置异或(`out[p] = in[p] ^ uint8(rotl32(key,p) + p)`)
|
||||
- `_so_code[]` = runtime 的 export/import/map/function 四张元数据表(`ReadFromBuffer` 逐张读)
|
||||
|
||||
`gen_inc_lin.py` 只能替 `_so_file`,`_so_code` 写空表。**后果:打包时 `FACE_LICENSE_INFO` 这些常量仍能被扫到并正确链接(实测注入 192 字节授权数据),但宿主对 SDK 授权函数的调用会被打成桩** —— 产物里 `DogProtectSetSerialNumber` 恒返 `2`(INVALID),自签序列号用不上。
|
||||
调试注入后的 runtime:`runtime/licensing_manager.cc::SetSerialNumber` 里有 `DOGDBG=1` 才输出的 `[dbrt]` 跟踪(序列号长度、CRC、解出的块头、密钥偏移),重建 blob 后 `DOGDBG=1 ./产物 序列号` 即可看到 runtime 内部到底走到哪一步。
|
||||
|
||||
真正要打通得生成 `_so_code`,那一步依赖厂商的 runtime 保护流水线(仓库里没有),所以默认仍用厂商的 blob;`gen_inc_lin.py` 与上面三处修复保留,供后续实验。
|
||||
|
||||
## 授权(licensing)相关
|
||||
|
||||
- Linux 目标统一按 **Ultimate** 版编译(`lin_common.mak` 里追加 `CFLAGS/CXXFLAGS += -DULTIMATE`)。
|
||||
授权子系统(`LicensingManager`、密钥对、`-lf` 授权参数文件)只在 ULTIMATE 分支里编译;
|
||||
不定义它会编译出 Professional,打包时直接报 `The licensing system not supported in this version`。
|
||||
- 工具自身注册状态:把 `core/DogProtectLicense.ini` 复制到 `bin/64/release/`(与 `dogprotect_con` 同目录),
|
||||
横幅会变成 `Registered to: ...`,此时才给满 10 个 VM executor 并开字节码加密。
|
||||
未注册时产物只有 1 个 executor、体积差 6 倍(894KB vs 5.3MB)。
|
||||
- 产物侧的序列号由 `tools/dogkeygen/dogkeygen` 生成:用工程里 `<LicenseManager>` 的 RSA 私钥做
|
||||
PKCS#1 v1.5 签名,产物端用同一工程的公钥校验。用法见 `tools/dogkeygen/README.md`。
|
||||
- 已知差异:打包产物里注入的 runtime 是仓库自带的**预编译 blob**(`core/*_runtime*.inc`),
|
||||
对自签序列号返回 `state=2`(INVALID)。要让产物端也接受自签序列号,需要先用 `runtime/` 源码重建该 blob;
|
||||
编译器侧(导入/校验序列号)走的是 `core.a` 里的同一个 `LicensingManager`,自签序列号已验证可用。
|
||||
|
||||
@@ -70,9 +70,9 @@ AboutDialog::AboutDialog(QWidget *parent)
|
||||
|
||||
purchase = new PushButton(QString::fromUtf8(language[lsPurchaseLicense].c_str()), this);
|
||||
#else
|
||||
VMProtectSerialNumberData data;
|
||||
DogProtectSerialNumberData data;
|
||||
data.nState = SERIAL_STATE_FLAG_INVALID;
|
||||
if (VMProtectGetSerialNumberData(&data, sizeof(data)) && data.nState == 0) {
|
||||
if (DogProtectGetSerialNumberData(&data, sizeof(data)) && data.nState == 0) {
|
||||
registered1->setText(QString("%1: <b>%2 [%3], %4</b>").arg(QString::fromUtf8(language[lsRegisteredTo].c_str())).
|
||||
arg(QString::fromUtf16((ushort *)data.wUserName)).
|
||||
arg(QString::fromUtf16((ushort *)data.wEMail)).
|
||||
@@ -89,10 +89,10 @@ AboutDialog::AboutDialog(QWidget *parent)
|
||||
}
|
||||
} else {
|
||||
if (data.nState & SERIAL_STATE_FLAG_BLACKLISTED) {
|
||||
registered1->setText(QString::fromLatin1(VMProtectDecryptStringA("Your key file is blocked!")));
|
||||
registered1->setText(QString::fromLatin1(DogProtectDecryptStringA("Your key file is blocked!")));
|
||||
// don't show "buy now" button
|
||||
} else if (data.nState & SERIAL_STATE_FLAG_MAX_BUILD_EXPIRED) {
|
||||
registered1->setText(QString::fromLatin1(VMProtectDecryptStringA("Your key file will not work with this version of VMProtect!\nYou should use older version or buy one more year of updates and technical support.")));
|
||||
registered1->setText(QString::fromLatin1(DogProtectDecryptStringA("Your key file will not work with this version of DogProtect!\nYou should use older version or buy one more year of updates and technical support.")));
|
||||
purchase = new PushButton(QString::fromUtf8(language[lsPurchaseSubscription].c_str()), this);
|
||||
if (data.nUserDataLength)
|
||||
purchaseMode = (data.bUserData[0] & 1) ? pmSubscriptionPersonal : pmSubscriptionCompany;
|
||||
@@ -160,7 +160,7 @@ AboutDialog::AboutDialog(QWidget *parent)
|
||||
|
||||
void AboutDialog::purchaseLicense()
|
||||
{
|
||||
QDesktopServices::openUrl(QUrl(VMProtectDecryptStringA("http://www.vmpsoft.com/purchase/buy-online/")));
|
||||
QDesktopServices::openUrl(QUrl(DogProtectDecryptStringA("http://www.dogprotect.example/purchase/buy-online/")));
|
||||
}
|
||||
|
||||
void AboutDialog::purchaseSubscriptionPersonal()
|
||||
@@ -113,7 +113,7 @@ void ExportKeyPairDialog::formatChanged(int format)
|
||||
QStringList lines;
|
||||
switch (format) {
|
||||
case 0:
|
||||
lines.append("VMProtectAlgorithms g_Algorithm = ALGORITHM_RSA;");
|
||||
lines.append("DogProtectAlgorithms g_Algorithm = ALGORITHM_RSA;");
|
||||
lines.append(QString("size_t g_nBits = %1;").arg(bits_));
|
||||
lines.append(QString("byte g_vPrivate[%1] = {").arg(private_exp_.size()));
|
||||
lines.append(VectorToString(private_exp_) + "};");
|
||||
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 527 B After Width: | Height: | Size: 527 B |
|
Before Width: | Height: | Size: 412 B After Width: | Height: | Size: 412 B |
|
Before Width: | Height: | Size: 327 B After Width: | Height: | Size: 327 B |
|
Before Width: | Height: | Size: 231 B After Width: | Height: | Size: 231 B |
|
Before Width: | Height: | Size: 213 B After Width: | Height: | Size: 213 B |
|
Before Width: | Height: | Size: 240 B After Width: | Height: | Size: 240 B |
|
Before Width: | Height: | Size: 227 B After Width: | Height: | Size: 227 B |
|
Before Width: | Height: | Size: 480 B After Width: | Height: | Size: 480 B |
|
Before Width: | Height: | Size: 254 B After Width: | Height: | Size: 254 B |
|
Before Width: | Height: | Size: 560 B After Width: | Height: | Size: 560 B |
|
Before Width: | Height: | Size: 249 B After Width: | Height: | Size: 249 B |
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 537 B After Width: | Height: | Size: 537 B |
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 533 B After Width: | Height: | Size: 533 B |
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 173 B After Width: | Height: | Size: 173 B |
|
Before Width: | Height: | Size: 350 B After Width: | Height: | Size: 350 B |
|
Before Width: | Height: | Size: 362 B After Width: | Height: | Size: 362 B |
|
Before Width: | Height: | Size: 295 B After Width: | Height: | Size: 295 B |
|
Before Width: | Height: | Size: 294 B After Width: | Height: | Size: 294 B |
|
Before Width: | Height: | Size: 300 B After Width: | Height: | Size: 300 B |
|
Before Width: | Height: | Size: 223 B After Width: | Height: | Size: 223 B |
|
Before Width: | Height: | Size: 228 B After Width: | Height: | Size: 228 B |
|
Before Width: | Height: | Size: 223 B After Width: | Height: | Size: 223 B |
|
Before Width: | Height: | Size: 467 B After Width: | Height: | Size: 467 B |
|
Before Width: | Height: | Size: 437 B After Width: | Height: | Size: 437 B |
|
Before Width: | Height: | Size: 468 B After Width: | Height: | Size: 468 B |
|
Before Width: | Height: | Size: 474 B After Width: | Height: | Size: 474 B |
|
Before Width: | Height: | Size: 907 B After Width: | Height: | Size: 907 B |
|
Before Width: | Height: | Size: 923 B After Width: | Height: | Size: 923 B |
|
Before Width: | Height: | Size: 695 B After Width: | Height: | Size: 695 B |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 928 B After Width: | Height: | Size: 928 B |
|
Before Width: | Height: | Size: 361 B After Width: | Height: | Size: 361 B |
|
Before Width: | Height: | Size: 300 B After Width: | Height: | Size: 300 B |
|
Before Width: | Height: | Size: 293 B After Width: | Height: | Size: 293 B |
|
Before Width: | Height: | Size: 299 B After Width: | Height: | Size: 299 B |
|
Before Width: | Height: | Size: 176 B After Width: | Height: | Size: 176 B |
|
Before Width: | Height: | Size: 215 B After Width: | Height: | Size: 215 B |
|
Before Width: | Height: | Size: 184 B After Width: | Height: | Size: 184 B |
|
Before Width: | Height: | Size: 235 B After Width: | Height: | Size: 235 B |
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 394 B After Width: | Height: | Size: 394 B |
|
Before Width: | Height: | Size: 310 B After Width: | Height: | Size: 310 B |
|
Before Width: | Height: | Size: 306 B After Width: | Height: | Size: 306 B |
|
Before Width: | Height: | Size: 317 B After Width: | Height: | Size: 317 B |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 283 B After Width: | Height: | Size: 283 B |
|
Before Width: | Height: | Size: 290 B After Width: | Height: | Size: 290 B |
|
Before Width: | Height: | Size: 383 B After Width: | Height: | Size: 383 B |
|
Before Width: | Height: | Size: 282 B After Width: | Height: | Size: 282 B |
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 993 B After Width: | Height: | Size: 993 B |
|
Before Width: | Height: | Size: 462 B After Width: | Height: | Size: 462 B |
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 357 B After Width: | Height: | Size: 357 B |
|
Before Width: | Height: | Size: 764 B After Width: | Height: | Size: 764 B |
|
Before Width: | Height: | Size: 265 B After Width: | Height: | Size: 265 B |
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 415 B After Width: | Height: | Size: 415 B |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 452 B After Width: | Height: | Size: 452 B |
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |