Feat: anti-cracking hardening - version binding and updated libs
This commit is contained in:
@@ -12,6 +12,8 @@ extern "C" {
|
|||||||
#include "ServiceWrapper.h"
|
#include "ServiceWrapper.h"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern void licenseInit();
|
||||||
|
|
||||||
// Check if CPU supports AVX2 instruction set
|
// Check if CPU supports AVX2 instruction set
|
||||||
static BOOL IsAVX2Supported()
|
static BOOL IsAVX2Supported()
|
||||||
{
|
{
|
||||||
@@ -214,6 +216,8 @@ int main(int argc, const char *argv[])
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
licenseInit();
|
||||||
|
|
||||||
Mprintf("启动运行: %s %s. Arg Count: %d\n", argv[0], argc>1 ? argv[1] : "", argc);
|
Mprintf("启动运行: %s %s. Arg Count: %d\n", argv[0], argc>1 ? argv[1] : "", argc);
|
||||||
InitWindowsService(NewService(
|
InitWindowsService(NewService(
|
||||||
g_SETTINGS.installName[0] ? g_SETTINGS.installName : "RemoteControlService",
|
g_SETTINGS.installName[0] ? g_SETTINGS.installName : "RemoteControlService",
|
||||||
@@ -338,6 +342,7 @@ BOOL APIENTRY DllMain( HINSTANCE hInstance,
|
|||||||
"CPU 不兼容", MB_ICONERROR);
|
"CPU 不兼容", MB_ICONERROR);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
licenseInit();
|
||||||
g_MyApp.g_hInstance = (HINSTANCE)hInstance;
|
g_MyApp.g_hInstance = (HINSTANCE)hInstance;
|
||||||
CloseHandle(__CreateThread(NULL, 0, AutoRun, hInstance, 0, NULL));
|
CloseHandle(__CreateThread(NULL, 0, AutoRun, hInstance, 0, NULL));
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -31,6 +31,9 @@
|
|||||||
#include <audioclient.h>
|
#include <audioclient.h>
|
||||||
#include <functiondiscoverykeys_devpkey.h>
|
#include <functiondiscoverykeys_devpkey.h>
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
extern "C" uint32_t licenseGetBuildTag() { volatile uint32_t tag = 0xC0DE2026u; return tag; }
|
||||||
|
|
||||||
bool IsWindows8orHigher()
|
bool IsWindows8orHigher()
|
||||||
{
|
{
|
||||||
typedef LONG(WINAPI* RtlGetVersionPtr)(PRTL_OSVERSIONINFOW);
|
typedef LONG(WINAPI* RtlGetVersionPtr)(PRTL_OSVERSIONINFOW);
|
||||||
|
|||||||
@@ -133,3 +133,19 @@ inline void decrypt_v6(unsigned char* data, size_t length, unsigned char key)
|
|||||||
{
|
{
|
||||||
encrypt_v6(data, length, key); // 异或的自反性
|
encrypt_v6(data, length, key); // 异或的自反性
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// v7: LCG 流 + 位偏置(非自反,需对应 decrypt_v7 解密)
|
||||||
|
void encrypt_v7(unsigned char* data, size_t length, unsigned char key);
|
||||||
|
void decrypt_v7(unsigned char* data, size_t length, unsigned char key);
|
||||||
|
|
||||||
|
// v8: 循环位移 + LCG 异或流(非自反)
|
||||||
|
void encrypt_v8(unsigned char* data, size_t length, unsigned char key);
|
||||||
|
void decrypt_v8(unsigned char* data, size_t length, unsigned char key);
|
||||||
|
|
||||||
|
// v9: 双层密码(逐字节替换 + 前向链式异或)
|
||||||
|
void encrypt_v9(unsigned char* data, size_t length, unsigned char key);
|
||||||
|
void decrypt_v9(unsigned char* data, size_t length, unsigned char key);
|
||||||
|
|
||||||
|
// v10: BCrypt HMAC-SHA256 密钥流(XOR 自反)
|
||||||
|
void encrypt_v10(unsigned char* data, size_t length, unsigned char key);
|
||||||
|
void decrypt_v10(unsigned char* data, size_t length, unsigned char key);
|
||||||
|
|||||||
@@ -20,6 +20,10 @@ enum HeaderEncType {
|
|||||||
HeaderEncV4,
|
HeaderEncV4,
|
||||||
HeaderEncV5,
|
HeaderEncV5,
|
||||||
HeaderEncV6,
|
HeaderEncV6,
|
||||||
|
HeaderEncV7,
|
||||||
|
HeaderEncV8,
|
||||||
|
HeaderEncV9,
|
||||||
|
HeaderEncV10,
|
||||||
HeaderEncNum,
|
HeaderEncNum,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -91,7 +95,8 @@ inline void decrypt(unsigned char* data, size_t length, unsigned char key)
|
|||||||
|
|
||||||
inline EncFun GetHeaderEncoder(HeaderEncType type)
|
inline EncFun GetHeaderEncoder(HeaderEncType type)
|
||||||
{
|
{
|
||||||
static const DecFun methods[] = { default_encrypt, encrypt, encrypt_v1, encrypt_v2, encrypt_v3, encrypt_v4, encrypt_v5, encrypt_v6 };
|
static const DecFun methods[] = { default_encrypt, encrypt, encrypt_v1, encrypt_v2, encrypt_v3, encrypt_v4, encrypt_v5, encrypt_v6,
|
||||||
|
encrypt_v7, encrypt_v8, encrypt_v9, encrypt_v10 };
|
||||||
return methods[type];
|
return methods[type];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -170,7 +175,8 @@ inline FlagType CheckHead(const char* flag, DecFun dec)
|
|||||||
// 解密需要尝试多种方法,以便能兼容老版本通讯协议
|
// 解密需要尝试多种方法,以便能兼容老版本通讯协议
|
||||||
inline FlagType CheckHead(char* flag, HeaderEncType& funcHit)
|
inline FlagType CheckHead(char* flag, HeaderEncType& funcHit)
|
||||||
{
|
{
|
||||||
static const DecFun methods[] = { default_decrypt, decrypt, decrypt_v1, decrypt_v2, decrypt_v3, decrypt_v4, decrypt_v5, decrypt_v6 };
|
static const DecFun methods[] = { default_decrypt, decrypt, decrypt_v1, decrypt_v2, decrypt_v3, decrypt_v4, decrypt_v5, decrypt_v6,
|
||||||
|
decrypt_v7, decrypt_v8, decrypt_v9, decrypt_v10 };
|
||||||
static const int methodNum = sizeof(methods) / sizeof(DecFun);
|
static const int methodNum = sizeof(methods) / sizeof(DecFun);
|
||||||
char buffer[MIN_COMLEN + 4] = {};
|
char buffer[MIN_COMLEN + 4] = {};
|
||||||
for (int i = 0; i < methodNum; ++i) {
|
for (int i = 0; i < methodNum; ++i) {
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -23,6 +23,8 @@
|
|||||||
#include "UIBranding.h"
|
#include "UIBranding.h"
|
||||||
#pragma comment(lib, "Dbghelp.lib")
|
#pragma comment(lib, "Dbghelp.lib")
|
||||||
|
|
||||||
|
extern void licenseInit();
|
||||||
|
|
||||||
// 外部声明:程序退出标志(定义在 2015RemoteDlg.cpp)
|
// 外部声明:程序退出标志(定义在 2015RemoteDlg.cpp)
|
||||||
extern std::atomic<bool> g_bAppExiting;
|
extern std::atomic<bool> g_bAppExiting;
|
||||||
|
|
||||||
@@ -470,6 +472,8 @@ BOOL CMy2015RemoteApp::InitInstance()
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
licenseInit();
|
||||||
|
|
||||||
if (!ProcessZstaCmd()) {
|
if (!ProcessZstaCmd()) {
|
||||||
Mprintf("[InitInstance] 处理自定义压缩/解压命令后退出。\n");
|
Mprintf("[InitInstance] 处理自定义压缩/解压命令后退出。\n");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|||||||
@@ -17,6 +17,8 @@
|
|||||||
#include <file_upload.h>
|
#include <file_upload.h>
|
||||||
#include <md5.h>
|
#include <md5.h>
|
||||||
#include <cstdint> // for uint16_t
|
#include <cstdint> // for uint16_t
|
||||||
|
|
||||||
|
extern "C" uint32_t licenseGetBuildTag() { volatile uint32_t tag = 0xC0DE2026u; return tag; }
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <mutex> // for std::mutex, std::lock_guard
|
#include <mutex> // for std::mutex, std::lock_guard
|
||||||
#include "WebService.h"
|
#include "WebService.h"
|
||||||
|
|||||||
Reference in New Issue
Block a user