• Ищем качественного (не новичок) разработчиков Xenforo для этого форума! В идеале, чтобы ты был фулл стек программистом. Если у тебя есть что показать, то свяжись с нами по контактным данным: https://t.me/DREDD

C++ Unhook ntdll for ud scyllahide bypass

Забаненный
Забаненный
Статус
Оффлайн
Регистрация
4 Апр 2023
Сообщения
107
Реакции
8
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Я хотел использовать Scyllahide и CheckRemoteDebuggerPresent, и некоторые другие вещи теперь это сдесь.
Также это можно использовать, чтобы просто анхукнуть любую dll , которую вы хотите.

biba:
Expand Collapse Copy
#include <iostream>
#include <Windows.h>
#include <winternl.h>
#include <psapi.h>
 
void unhookModule(const char* modulePath) {
    HANDLE process = GetCurrentProcess();
    MODULEINFO moduleInfo = {};
    HMODULE moduleHandle = GetModuleHandleA(modulePath);
 
    if (moduleHandle == NULL) {
        std::cerr << "Failed to get handle for module: " << modulePath << std::endl;
        return;
    }
 
    GetModuleInformation(process, moduleHandle, &moduleInfo, sizeof(moduleInfo));
    LPVOID moduleBase = moduleInfo.lpBaseOfDll;
 
    HANDLE moduleFile = CreateFileA(modulePath, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
    if (moduleFile == INVALID_HANDLE_VALUE) {
        std::cerr << "Failed to open file for module: " << modulePath << std::endl;
        CloseHandle(process);
        return;
    }
 
    HANDLE moduleMapping = CreateFileMapping(moduleFile, NULL, PAGE_READONLY | SEC_IMAGE, 0, 0, NULL);
    if (moduleMapping == NULL) {
        std::cerr << "Failed to create file mapping for module: " << modulePath << std::endl;
        CloseHandle(moduleFile);
        CloseHandle(process);
        return;
    }
 
    LPVOID mappingAddress = MapViewOfFile(moduleMapping, FILE_MAP_READ, 0, 0, 0);
    if (mappingAddress == NULL) {
        std::cerr << "Failed to map view of file for module: " << modulePath << std::endl;
        CloseHandle(moduleMapping);
        CloseHandle(moduleFile);
        CloseHandle(process);
        return;
    }
 
    PIMAGE_DOS_HEADER dosHeader = (PIMAGE_DOS_HEADER)moduleBase;
    PIMAGE_NT_HEADERS ntHeader = (PIMAGE_NT_HEADERS)((DWORD_PTR)moduleBase + dosHeader->e_lfanew);
 
    for (WORD i = 0; i < ntHeader->FileHeader.NumberOfSections; i++) {
        PIMAGE_SECTION_HEADER sectionHeader = (PIMAGE_SECTION_HEADER)((DWORD_PTR)IMAGE_FIRST_SECTION(ntHeader) + ((DWORD_PTR)IMAGE_SIZEOF_SECTION_HEADER * i));
        
        if (!strcmp((char*)sectionHeader->Name, ".text")) {
            DWORD oldProtection = 0;
            VirtualProtect((LPVOID)((DWORD_PTR)moduleBase + (DWORD_PTR)sectionHeader->VirtualAddress), sectionHeader->Misc.VirtualSize, PAGE_EXECUTE_READWRITE, &oldProtection);
            memcpy((LPVOID)((DWORD_PTR)moduleBase + (DWORD_PTR)sectionHeader->VirtualAddress), (LPVOID)((DWORD_PTR)mappingAddress + (DWORD_PTR)sectionHeader->VirtualAddress), sectionHeader->Misc.VirtualSize);
            VirtualProtect((LPVOID)((DWORD_PTR)moduleBase + (DWORD_PTR)sectionHeader->VirtualAddress), sectionHeader->Misc.VirtualSize, oldProtection, &oldProtection);
        }
    }
    
    CloseHandle(process);
    CloseHandle(moduleFile);
    CloseHandle(moduleMapping);
    FreeLibrary(moduleHandle);
}
 
int main() {
    const char* modulePath = "C:\\Windows\\System32\\ntdll.dll";
    unhookModule(modulePath);
    return 0;
}
 
  • Мне нравится
Реакции: mj12
Последнее редактирование:
Я хотел использовать Scyllahide и CheckRemoteDebuggerPresent, и некоторые другие вещи теперь это сдесь.
Также это можно использовать, чтобы просто анхукнуть любую dll , которую вы хотите.

biba:
Expand Collapse Copy
#include <iostream>
#include <Windows.h>
#include <winternl.h>
#include <psapi.h>

void unhookModule(const char* modulePath) {
    HANDLE process = GetCurrentProcess();
    MODULEINFO moduleInfo = {};
    HMODULE moduleHandle = GetModuleHandleA(modulePath);

    if (moduleHandle == NULL) {
        std::cerr << "Failed to get handle for module: " << modulePath << std::endl;
        return;
    }

    GetModuleInformation(process, moduleHandle, &moduleInfo, sizeof(moduleInfo));
    LPVOID moduleBase = moduleInfo.lpBaseOfDll;

    HANDLE moduleFile = CreateFileA(modulePath, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
    if (moduleFile == INVALID_HANDLE_VALUE) {
        std::cerr << "Failed to open file for module: " << modulePath << std::endl;
        CloseHandle(process);
        return;
    }

    HANDLE moduleMapping = CreateFileMapping(moduleFile, NULL, PAGE_READONLY | SEC_IMAGE, 0, 0, NULL);
    if (moduleMapping == NULL) {
        std::cerr << "Failed to create file mapping for module: " << modulePath << std::endl;
        CloseHandle(moduleFile);
        CloseHandle(process);
        return;
    }

    LPVOID mappingAddress = MapViewOfFile(moduleMapping, FILE_MAP_READ, 0, 0, 0);
    if (mappingAddress == NULL) {
        std::cerr << "Failed to map view of file for module: " << modulePath << std::endl;
        CloseHandle(moduleMapping);
        CloseHandle(moduleFile);
        CloseHandle(process);
        return;
    }

    PIMAGE_DOS_HEADER dosHeader = (PIMAGE_DOS_HEADER)moduleBase;
    PIMAGE_NT_HEADERS ntHeader = (PIMAGE_NT_HEADERS)((DWORD_PTR)moduleBase + dosHeader->e_lfanew);

    for (WORD i = 0; i < ntHeader->FileHeader.NumberOfSections; i++) {
        PIMAGE_SECTION_HEADER sectionHeader = (PIMAGE_SECTION_HEADER)((DWORD_PTR)IMAGE_FIRST_SECTION(ntHeader) + ((DWORD_PTR)IMAGE_SIZEOF_SECTION_HEADER * i));
      
        if (!strcmp((char*)sectionHeader->Name, ".text")) {
            DWORD oldProtection = 0;
            VirtualProtect((LPVOID)((DWORD_PTR)moduleBase + (DWORD_PTR)sectionHeader->VirtualAddress), sectionHeader->Misc.VirtualSize, PAGE_EXECUTE_READWRITE, &oldProtection);
            memcpy((LPVOID)((DWORD_PTR)moduleBase + (DWORD_PTR)sectionHeader->VirtualAddress), (LPVOID)((DWORD_PTR)mappingAddress + (DWORD_PTR)sectionHeader->VirtualAddress), sectionHeader->Misc.VirtualSize);
            VirtualProtect((LPVOID)((DWORD_PTR)moduleBase + (DWORD_PTR)sectionHeader->VirtualAddress), sectionHeader->Misc.VirtualSize, oldProtection, &oldProtection);
        }
    }
  
    CloseHandle(process);
    CloseHandle(moduleFile);
    CloseHandle(moduleMapping);
    FreeLibrary(moduleHandle);
}

int main() {
    const char* modulePath = "C:\\Windows\\System32\\ntdll.dll";
    unhookModule(modulePath);
    return 0;
}
круто бро выебал сциллу в жопу :imp:
 
Последнее редактирование:
АХХАХАХАХАХАХАХАХА
 
Я хотел использовать Scyllahide и CheckRemoteDebuggerPresent, и некоторые другие вещи теперь это сдесь.
Также это можно использовать, чтобы просто анхукнуть любую dll , которую вы хотите.

biba:
Expand Collapse Copy
#include <iostream>
#include <Windows.h>
#include <winternl.h>
#include <psapi.h>

void unhookModule(const char* modulePath) {
    HANDLE process = GetCurrentProcess();
    MODULEINFO moduleInfo = {};
    HMODULE moduleHandle = GetModuleHandleA(modulePath);

    if (moduleHandle == NULL) {
        std::cerr << "Failed to get handle for module: " << modulePath << std::endl;
        return;
    }

    GetModuleInformation(process, moduleHandle, &moduleInfo, sizeof(moduleInfo));
    LPVOID moduleBase = moduleInfo.lpBaseOfDll;

    HANDLE moduleFile = CreateFileA(modulePath, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
    if (moduleFile == INVALID_HANDLE_VALUE) {
        std::cerr << "Failed to open file for module: " << modulePath << std::endl;
        CloseHandle(process);
        return;
    }

    HANDLE moduleMapping = CreateFileMapping(moduleFile, NULL, PAGE_READONLY | SEC_IMAGE, 0, 0, NULL);
    if (moduleMapping == NULL) {
        std::cerr << "Failed to create file mapping for module: " << modulePath << std::endl;
        CloseHandle(moduleFile);
        CloseHandle(process);
        return;
    }

    LPVOID mappingAddress = MapViewOfFile(moduleMapping, FILE_MAP_READ, 0, 0, 0);
    if (mappingAddress == NULL) {
        std::cerr << "Failed to map view of file for module: " << modulePath << std::endl;
        CloseHandle(moduleMapping);
        CloseHandle(moduleFile);
        CloseHandle(process);
        return;
    }

    PIMAGE_DOS_HEADER dosHeader = (PIMAGE_DOS_HEADER)moduleBase;
    PIMAGE_NT_HEADERS ntHeader = (PIMAGE_NT_HEADERS)((DWORD_PTR)moduleBase + dosHeader->e_lfanew);

    for (WORD i = 0; i < ntHeader->FileHeader.NumberOfSections; i++) {
        PIMAGE_SECTION_HEADER sectionHeader = (PIMAGE_SECTION_HEADER)((DWORD_PTR)IMAGE_FIRST_SECTION(ntHeader) + ((DWORD_PTR)IMAGE_SIZEOF_SECTION_HEADER * i));
       
        if (!strcmp((char*)sectionHeader->Name, ".text")) {
            DWORD oldProtection = 0;
            VirtualProtect((LPVOID)((DWORD_PTR)moduleBase + (DWORD_PTR)sectionHeader->VirtualAddress), sectionHeader->Misc.VirtualSize, PAGE_EXECUTE_READWRITE, &oldProtection);
            memcpy((LPVOID)((DWORD_PTR)moduleBase + (DWORD_PTR)sectionHeader->VirtualAddress), (LPVOID)((DWORD_PTR)mappingAddress + (DWORD_PTR)sectionHeader->VirtualAddress), sectionHeader->Misc.VirtualSize);
            VirtualProtect((LPVOID)((DWORD_PTR)moduleBase + (DWORD_PTR)sectionHeader->VirtualAddress), sectionHeader->Misc.VirtualSize, oldProtection, &oldProtection);
        }
    }
   
    CloseHandle(process);
    CloseHandle(moduleFile);
    CloseHandle(moduleMapping);
    FreeLibrary(moduleHandle);
}

int main() {
    const char* modulePath = "C:\\Windows\\System32\\ntdll.dll";
    unhookModule(modulePath);
    return 0;
}
ну пиздец
 
Дружище, если ты думаешь что пиздя темы ты будешь супер крутым, то ты ошибаешься
 
Назад
Сверху Снизу