Есть такой простой обход вм, что можно
исправить/улучшить?
C++:
#include <windows.h>
#include <tlhelp32.h>
#include <string>
#include <tchar.h>
bool IsSandbox() {
DWORD uptime = GetTickCount();
if (uptime < 2 * 60 * 1000) {
return true;
}
return false;
}
bool IsLowSpecMachine() {
MEMORYSTATUSEX memInfo;
memInfo.dwLength = sizeof(memInfo);
GlobalMemoryStatusEx(&memInfo);
if (memInfo.ullTotalPhys < (4ULL * 1024 * 1024 * 1024)) { // меньше 4 ГБ ОЗУ
return true;
}
SYSTEM_INFO sysInfo;
GetSystemInfo(&sysInfo);
if (sysInfo.dwNumberOfProcessors < 2) { // меньше 2 ядер
return true;
}
return false;
}
bool IsDebugged() {
if (IsDebuggerPresent()) {
return true;
}
BOOL isDebugged = FALSE;
CheckRemoteDebuggerPresent(GetCurrentProcess(), &isDebugged);
return isDebugged;
}
bool IsVM() {
const TCHAR* suspiciousProcesses[] = {
_T("vmtoolsd.exe"),
_T("vmware.exe"),
_T("vboxservice.exe"),
_T("wireshark.exe")
};
HANDLE hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
PROCESSENTRY32 pe32;
pe32.dwSize = sizeof(PROCESSENTRY32);
if (Process32First(hSnapshot, &pe32)) {
do {
for (const TCHAR* proc : suspiciousProcesses) {
if (_tcsicmp(pe32.szExeFile, proc) == 0) {
CloseHandle(hSnapshot);
return true;
}
}
} while (Process32Next(hSnapshot, &pe32));
}
CloseHandle(hSnapshot);
return false;
}
bool IsRealUserPresent() {
POINT p1, p2;
GetCursorPos(&p1);
Sleep(5000); // ждем 5 секунд
GetCursorPos(&p2);
// Если мышь не двигалась, возможно, это песочница
return (p1.x != p2.x || p1.y != p2.y);
}
int main() {
if (IsSandbox()) {
ExitProcess(0);
}
if (IsLowSpecMachine()) {
ExitProcess(0);
}
if (IsDebugged()) {
ExitProcess(0);
}
if (IsVM()) {
ExitProcess(0);
}
if (!IsRealUserPresent()) {
ExitProcess(0);
}
Sleep(5 * 60 * 1000);
return 0;
}