資源簡介
QQ華夏,過反調試檢測代碼,僅用于學習交流,切勿用于違法用途,否則本人一概不負責任,不同意切建議勿下載或者立即刪除。
代碼片段和文件信息
#include?“Main.h“
#include?“PassSafe.h“
BOOL?APIENTRY?DllMain(
HMODULE?hModule
DWORD??ul_reason_for_call
LPVOID?lpReserved)
{
switch?(ul_reason_for_call)
{
case?DLL_PROCESS_ATTACH:
{
QQhxPassSafe();
}break;
case?DLL_THREAD_ATTACH:
{
}break;
case?DLL_THREAD_DETACH:
{
}break;
case?DLL_PROCESS_DETACH:
{
}break;
}
return?TRUE;
}
void?QQhxPassSafe()
{
//?檢測調試器附加
ULONG?IsDebuggerPresentAddr?=?0;
ULONG?CheckRemoteDebuggerPresentAddr?=?0;
ULONG?NtQueryInformationProcessAddr?=?0;
IsDebuggerPresentAddr?=?GetModuleFunction(“KERNELbase.DLL“?“IsDebuggerPresent“);
if?(!IsDebuggerPresentAddr)
{
MessageBox(NULL?“未找到?IsDebuggerPresent“?“錯誤“?MB_OK);
return;
}
CheckRemoteDebuggerPresentAddr?=?GetModuleFunction(“kernel32.dll“?“CheckRemoteDebuggerPresent“);
if?(!CheckRemoteDebuggerPresentAddr)
{
MessageBox(NULL?“未找到?CheckRemoteDebuggerPresent“?“錯誤“?MB_OK);
return;
}
NtQueryInformationProcessAddr?=?GetModuleFunction(“ntdll.dll“?“NtQueryInformationProcess“);
if?(!CheckRemoteDebuggerPresentAddr)
{
MessageBox(NULL?“未找到?NtQueryInformationProcess“?“錯誤“?MB_OK);
return;
}
JMP(IsDebuggerPresentAddr?(ULONG)PassSafe_IsDebuggerPresent);
JMP(CheckRemoteDebuggerPresentAddr?(ULONG)PassSafe_CheckRemoteDebuggerPresent);
JMP(NtQueryInformationProcessAddr?(ULONG)PassSafe_NtQueryInformationProcess);
//?檢測斷點
ULONG?NtSetinformationThreadAddr?=?0;
NtSetinformationThreadAddr?=?GetModuleFunction(“ntdll.dll“?“NtSetInformationThread“);
if?(!CheckRemoteDebuggerPresentAddr)
{
MessageBox(NULL?“未找到?NtSetinformationThread“?“錯誤“?MB_OK);
return;
}
JMP(NtSetinformationThreadAddr?(ULONG)PassSafe_NtSetInformationThread);
//?檢測進程?游戲會枚舉進程是否存在非法調試器
ULONG?EnumProcessesAddr?=?GetModuleFunction(“PSAPI.DLL“?“EnumProcesses“);
if?(!EnumProcessesAddr?||?!SetMemoryProtect(EnumProcessesAddr?8?PAGE_EXECUTE_READWRITE))
{
MessageBox(NULL?“Pass?EnumProcesses?失敗“?“錯誤“?MB_OK);
return;
}
else
{
byte?code[]?=?{?0xB80x000x000x000x000xC20x0C0x00?};
memcpy((void*)EnumProcessesAddr?code?8);
}
//?檢測窗口?游戲會枚舉窗口文字是否有非法文字
ULONG?EnumWindowsAddr?=?GetModuleFunction(“user32.dll“?“EnumWindows“);
if?(!EnumWindowsAddr?||?!SetMemoryProtect(EnumWindowsAddr?8?PAGE_EXECUTE_READWRITE))
{
MessageBox(NULL?“Pass?EnumWindows?失敗“?“錯誤“?MB_OK);
return;
}
else
{
byte?code[]?=?{?0xB80x000x000x000x000xC20x080x00?};
memcpy((void*)EnumWindowsAddr?code?8);
}
//?創建一個線程等待游戲加載完檢測模塊在恢復HOOK
HANDLE?hThread?=?CreateThread(NULL?0?PassSafeThread?NULL?0?NULL);
if?(!hThread)
{
MessageBox(NULL?“創建?PassSafeThread?失敗“?“錯誤“?MB_OK);
return;
}
CloseHandle(hThread);
}
ULONG?GetModuleFunction(const?char*?szModuleName?const?char*?szFunctionName)
{
HMODULE?hModule?=?NULL;
hModule?=?GetModuleHandle(szModuleName);
if?(!hModule)
{
retur
- 上一篇:廢品回收網站的設計與開發開題報告
- 下一篇:連連看游戲的設計思路文檔
評論
共有 條評論