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: 删掉改名说明,补授权与构建要点
This commit is contained in:
+10
-4
@@ -3563,11 +3563,17 @@ void ProjectTemplate::Init()
|
||||
{
|
||||
options_ = cpMaximumProtection;
|
||||
|
||||
// VM code section name: fixed brand name instead of a random ".xyz" one
|
||||
// (upstream randomized it to dodge section-name signatures; set your own via
|
||||
// the project settings / VMCodeSectionName if you want that behaviour back)
|
||||
vm_section_name_ = ".dog";
|
||||
// create random section name
|
||||
vm_section_name_ = ".";
|
||||
size_t i;
|
||||
static const char alphanum[] =
|
||||
"0123456789"
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||
"abcdefghijklmnopqrstuvwxyz";
|
||||
srand(os::GetTickCount());
|
||||
for (i = 0; i < 3; i++) {
|
||||
vm_section_name_ += alphanum[rand() % (sizeof(alphanum) - 1)];
|
||||
}
|
||||
|
||||
for (i = 0; i < _countof(messages_); i++) {
|
||||
#ifdef VMP_GNU
|
||||
|
||||
+8
-2
@@ -6409,7 +6409,7 @@ void NETImportList::ReadFromFile(NETArchitecture &file)
|
||||
if (!import) {
|
||||
import = Add(assembly_ref->id(), module_name);
|
||||
std::transform(module_name.begin(), module_name.end(), module_name.begin(), tolower);
|
||||
if (module_name == "dogprotect.sdk")
|
||||
if (module_name == "dogprotect.sdk" || module_name == "vmprotect.sdk")
|
||||
import->set_is_sdk(true);
|
||||
}
|
||||
import_map[assembly_ref] = import;
|
||||
@@ -6466,9 +6466,15 @@ void NETImportList::ReadFromFile(NETArchitecture &file)
|
||||
std::string ret_name = member_ref->signature()->ret_name();
|
||||
NETImportFunction *func = import->Add(member_ref->id(), member_ref->full_name(), ret_name.empty() ? 0 : ret_name.size() + 1);
|
||||
if (import->is_sdk()) {
|
||||
std::string func_name = func->name();
|
||||
// legacy managed SDK kept the same API behind the VMProtect.* namespace
|
||||
const std::string legacy_ns = "VMProtect.";
|
||||
for (size_t pos = func_name.find(legacy_ns); pos != std::string::npos; pos = func_name.find(legacy_ns, pos + 1))
|
||||
func_name.replace(pos, legacy_ns.size(), "DogProtect.");
|
||||
|
||||
for (size_t i = 0; i < _countof(sdk_info); i++) {
|
||||
const ImportInfo *import_info = &sdk_info[i];
|
||||
if (func->name().compare(import_info->name) == 0) {
|
||||
if (func_name.compare(import_info->name) == 0) {
|
||||
func->set_type(import_info->type);
|
||||
if (import_info->options & ioHasCompilationType) {
|
||||
func->include_option(ioHasCompilationType);
|
||||
|
||||
+1
-1
@@ -1107,7 +1107,7 @@ void ELFImportList::ReadFromFile(ELFArchitecture &file)
|
||||
ELFImport *import = Add(dir->str_value());
|
||||
std::string dll_name = os::ExtractFileName(import->name().c_str());
|
||||
std::transform(dll_name.begin(), dll_name.end(), dll_name.begin(), tolower);
|
||||
if (dll_name.compare(sdk_name) == 0) {
|
||||
if (dll_name.compare(sdk_name) == 0 || IsLegacySDKLibraryName(dll_name)) {
|
||||
import->set_is_sdk(true);
|
||||
if (!sdk_import)
|
||||
sdk_import = import;
|
||||
|
||||
+35
-1
@@ -631,8 +631,42 @@ uint32_t BaseImportList::GetSDKOptions() const
|
||||
return res;
|
||||
}
|
||||
|
||||
bool IsLegacySDKLibraryName(const std::string &lower_name)
|
||||
{
|
||||
// 3.x SDK/DDK 的库名与大写函数名保持兼容:
|
||||
// VMProtectSDK{32,64}.dll / VMProtectDDK{32,64}.sys / libVMProtectSDK{32,64}.so / libVMProtectSDK.dylib
|
||||
static const char *legacy_names[] = {
|
||||
"vmprotectsdk32.dll",
|
||||
"vmprotectsdk64.dll",
|
||||
"vmprotectddk32.sys",
|
||||
"vmprotectddk64.sys",
|
||||
"libvmprotectsdk32.so",
|
||||
"libvmprotectsdk64.so",
|
||||
"libvmprotectsdk.dylib"
|
||||
};
|
||||
|
||||
for (size_t i = 0; i < _countof(legacy_names); i++) {
|
||||
if (lower_name.compare(legacy_names[i]) == 0)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string NormalizeSDKFunctionName(const std::string &name)
|
||||
{
|
||||
// 旧导出名与现名只差前缀
|
||||
static const std::string legacy_prefix = "VMProtect";
|
||||
if (name.size() > legacy_prefix.size() && name.compare(0, legacy_prefix.size(), legacy_prefix) == 0)
|
||||
return std::string("DogProtect") + name.substr(legacy_prefix.size());
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
const ImportInfo *BaseImportList::GetSDKInfo(const std::string &name) const
|
||||
{
|
||||
const std::string sdk_function_name = NormalizeSDKFunctionName(name);
|
||||
|
||||
static const ImportInfo sdk_info[] = {
|
||||
{atBegin, "DogProtectBegin", ioNone, ctNone},
|
||||
{atBegin, "DogProtectBeginVirtualization", ioHasCompilationType, ctVirtualization},
|
||||
@@ -660,7 +694,7 @@ const ImportInfo *BaseImportList::GetSDKInfo(const std::string &name) const
|
||||
|
||||
for (size_t i = 0; i < _countof(sdk_info); i++) {
|
||||
const ImportInfo *import_info = &sdk_info[i];
|
||||
if (name.compare(import_info->name) == 0)
|
||||
if (sdk_function_name.compare(import_info->name) == 0)
|
||||
return import_info;
|
||||
}
|
||||
|
||||
|
||||
@@ -438,6 +438,9 @@ private:
|
||||
bool excluded_from_import_protection_;
|
||||
};
|
||||
|
||||
// true when the given (lowercased) module name is a legacy VMProtect-era SDK/DDK library
|
||||
bool IsLegacySDKLibraryName(const std::string &lower_name);
|
||||
|
||||
class BaseImportList : public IImportList
|
||||
{
|
||||
public:
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 118 KiB After Width: | Height: | Size: 57 KiB |
+1
-1
@@ -19577,7 +19577,7 @@ void IntelFileHelper::Parse(IArchitecture &file)
|
||||
std::transform(dll_name.begin(), dll_name.end(), dll_name.begin(), tolower);
|
||||
if (dll_name.find('.') == NOT_ID)
|
||||
dll_name += ".dll";
|
||||
if (dll_name == "dogprotectsdk32.dll") {
|
||||
if (dll_name == "dogprotectsdk32.dll" || IsLegacySDKLibraryName(dll_name)) {
|
||||
const ImportInfo *import_info = file.import_list()->GetSDKInfo(func_name);
|
||||
if (import_info) {
|
||||
CompilerFunction *compiler_function = compiler_function_list->Add(func_type, address);
|
||||
|
||||
+1
-1
@@ -1424,7 +1424,7 @@ void MacImportList::ReadFromFile(MacArchitecture &file)
|
||||
std::transform(dll_name.begin(), dll_name.end(), dll_name.begin(), tolower);
|
||||
std::string sdk_name = "libdogprotectsdk.dylib";
|
||||
|
||||
if (dll_name.compare(sdk_name) == 0) {
|
||||
if (dll_name.compare(sdk_name) == 0 || IsLegacySDKLibraryName(dll_name)) {
|
||||
import->set_is_sdk(true);
|
||||
if (import->count() == 0) {
|
||||
if (MacImport *flat_lookup_import = GetLibraryByOrdinal(BIND_SPECIAL_DYLIB_FLAT_LOOKUP)) {
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 107 KiB After Width: | Height: | Size: 51 KiB |
+1
-1
@@ -726,7 +726,7 @@ bool PEImport::ReadFromFile(PEArchitecture &file)
|
||||
sdk_name = string_format("dogprotectsdk%d.dll", (file.cpu_address_size() == osDWord) ? 32 : 64);
|
||||
}
|
||||
|
||||
if (dll_name.compare(sdk_name) == 0) {
|
||||
if (dll_name.compare(sdk_name) == 0 || IsLegacySDKLibraryName(dll_name)) {
|
||||
is_sdk_ = true;
|
||||
for (i = 0; i < count(); i++) {
|
||||
func = item(i);
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 111 KiB After Width: | Height: | Size: 73 KiB |
Reference in New Issue
Block a user