Подписывайтесь на наш Telegram и не пропускайте важные новости! Перейти

LUA скрипт [GS] chatgpt хвид для лоадера

Начинающий
Начинающий
Статус
Оффлайн
Регистрация
14 Май 2023
Сообщения
387
Реакции
11
хз кому это надо

vibecoded + pasted:
Expand Collapse Copy
local ffi = require("ffi")

local find_signature = client.find_signature or function() return nil end

local pGetModuleHandle_sig = find_signature("engine.dll", "\xFF\x15\xCC\xCC\xCC\xCC\x85\xC0\x74\x0B") or error("signature #1 not found")
local pGetProcAddress_sig = find_signature("engine.dll", "\xFF\x15\xCC\xCC\xCC\xCC\xA3\xCC\xCC\xCC\xCC\xEB\x05") or error("signature #2 not found")
local jmp_ecx = find_signature("engine.dll", "\xFF\xE1") or error("signature #3 not found")

local pGetProcAddress = ffi.cast("uint32_t**", ffi.cast("uint32_t", pGetProcAddress_sig) + 2)[0][0]
local fnGetProcAddress = ffi.cast("uint32_t(__fastcall*)(unsigned int, unsigned int, uint32_t, const char*)", jmp_ecx)
local pGetModuleHandle = ffi.cast("uint32_t**", ffi.cast("uint32_t", pGetModuleHandle_sig) + 2)[0][0]
local fnGetModuleHandle = ffi.cast("uint32_t(__fastcall*)(unsigned int, unsigned int, const char*)", jmp_ecx)

local function proc_bind(module_name, function_name, typedef)
    local ctype = ffi.typeof(typedef)
    local module_handle = fnGetModuleHandle(pGetModuleHandle, 0, module_name)
    local proc_address = fnGetProcAddress(pGetProcAddress, 0, module_handle, function_name)
    local call_fn = ffi.cast(ctype, jmp_ecx)
    return function(...) return call_fn(proc_address, 0, ...) end
end

ffi.cdef[[
    typedef void VOID;
    typedef VOID* LPVOID;
    typedef const char* LPCSTR;
    typedef char* LPSTR;
    typedef unsigned long DWORD;
    typedef int BOOL;
    typedef unsigned __int64 ULONGLONG;
    typedef struct { DWORD dwLength; DWORD dwMemoryLoad; ULONGLONG ullTotalPhys; ULONGLONG ullAvailPhys; ULONGLONG ullTotalPageFile; ULONGLONG ullAvailPageFile; ULONGLONG ullTotalVirtual; ULONGLONG ullAvailVirtual; ULONGLONG ullAvailExtendedVirtual; } MEMORYSTATUSEX, *LPMEMORYSTATUSEX;
    typedef struct { union { DWORD dwOemId; struct { uint16_t wProcessorArchitecture; uint16_t wReserved; } DUMMY; } DUMMYUNION; DWORD dwPageSize; LPVOID lpMinAddr; LPVOID lpMaxAddr; uintptr_t dwActiveMask; DWORD dwNumberOfProcessors; DWORD dwProcessorType; DWORD dwAllocGran; uint16_t wProcessorLevel; uint16_t wProcessorRevision; } SYSTEM_INFO, *LPSYSTEM_INFO;
    typedef struct { char m_pDriverName[512]; unsigned int m_VendorID; unsigned int m_DeviceID; unsigned int m_SubSysID; unsigned int m_Revision; int m_nDXSupportLevel; int m_nMinDXSupportLevel; int m_nMaxDXSupportLevel; unsigned int m_nDriverVersionHigh; unsigned int m_nDriverVersionLow; } MaterialAdapterInfo_t;
]]

local GlobalMemoryStatusEx = proc_bind("kernel32.dll", "GlobalMemoryStatusEx", "BOOL(__fastcall*)(unsigned int, unsigned int, LPMEMORYSTATUSEX)")
local GetSystemInfo = proc_bind("kernel32.dll", "GetSystemInfo", "void(__fastcall*)(unsigned int, unsigned int, LPSYSTEM_INFO)")
local GetVolumeInformationA = proc_bind("kernel32.dll", "GetVolumeInformationA", "BOOL(__fastcall*)(unsigned int, unsigned int, LPCSTR, LPSTR, DWORD, DWORD*, DWORD*, DWORD*, LPSTR, DWORD)")

local function GetRAM()
    local ms = ffi.new("MEMORYSTATUSEX")
    ms.dwLength = ffi.sizeof(ms)
    if GlobalMemoryStatusEx and GlobalMemoryStatusEx(ms) ~= 0 then
        return math.floor(tonumber(ms.ullTotalPhys / (1024 * 1024)))
    end
    return 0
end

local function GetDisk()
    local serial = ffi.new("DWORD[1]")
    if GetVolumeInformationA and GetVolumeInformationA("C:\\", nil, 0, serial, nil, nil, nil, 0) ~= 0 then
        return serial[0]
    end
    return 0
end

local function GetCPU()
    local si = ffi.new("SYSTEM_INFO")
    if GetSystemInfo then GetSystemInfo(si) end
    return { level = si.wProcessorLevel or 0, cores = si.dwNumberOfProcessors or 1 }
end

local function GetGPU()
    local get_current = vtable_bind("materialsystem.dll", "VMaterialSystem080", 25, "int(__thiscall*)(void*)")
    local get_info = vtable_bind("materialsystem.dll", "VMaterialSystem080", 26, "void(__thiscall*)(void*, int, void*)")
    local info = ffi.new("MaterialAdapterInfo_t")
    if get_current and get_info then
        get_info(get_current(), info)
        return info.m_VendorID, info.m_DeviceID
    end
    return 0, 0
end

function gethwid()
    local ram = GetRAM()
    local disk = GetDisk()
    local cpu = GetCPU()
    local g_ven, g_dev = GetGPU()

    local hwid = string.format("%02X%02X%04X%04X%04X%08X",
        math.min(cpu.level, 0xFF),
        math.min(cpu.cores, 0xFF),
        math.min(ram, 0xFFFF),
        math.min(g_ven, 0xFFFF),
        math.min(g_dev, 0xFFFF),
        disk
    )
    return string.upper(hwid)
end

print("HWID: " .. gethwid())
 
Назад
Сверху Снизу