看流星社区

 找回密码
 注册账号
查看: 3477|回复: 1

反游戏内存扫描源码 Hook NtQueryVirtualMemory

[复制链接]

该用户从未签到

发表于 2018-3-8 11:08:09 | 显示全部楼层 |阅读模式

反游戏内存扫描源码 Hook NtQueryVirtualMemory

  1. //反扫描模块
  2. NTSTATUS __stdcall NewZwQueryVirtualMemory(
  3.         IN HANDLE ProcessHandle,   
  4.         IN PVOID BaseAddress,   
  5.         IN ULONG MemoryInformationClass,   
  6.         OUT PVOID MemoryInformation,   
  7.         IN ULONG MemoryInformationLength,   
  8.         OUT PULONG ReturnLength
  9.         )
  10. {
  11.         ZWQUERYVIRTUALMEMORY OldZwQueryVirtualMemory;
  12.         NTSTATUS status;
  13.         PUNICODE_STRING SectionName;
  14.         WCHAR lpwzDllName[260] = {0};
  15.         WCHAR lpAttackDll[5][260] = {L"1",L"2",L"3",L"4",L"5"};//保护模块的名称  防止被dump内存上传
  16.         OldZwQueryVirtualMemory = (ZWQUERYVIRTUALMEMORY)ZwQueryVirtualMemoryHookZone;
  17.         status = OldZwQueryVirtualMemory(
  18.                 ProcessHandle,
  19.                 BaseAddress,
  20.                 MemoryInformationClass,
  21.                 MemoryInformation,
  22.                 MemoryInformationLength,
  23.                 ReturnLength
  24.                 );
  25.         if (status == STATUS_SUCCESS && MemoryInformationClass == MemorySectionName)
  26.         {
  27.                 __try{
  28.                         SectionName =(PUNICODE_STRING)MemoryInformation;
  29.                         if (ValidateUnicodeString(SectionName))
  30.                         {
  31.                                 if (SectionName->Buffer != NULL &&
  32.                                         SectionName->Length)
  33.                                 {
  34.                                         memcpy(lpwzDllName,SectionName->Buffer,SectionName->Length);
  35.                                         if (wcsstr(lpwzDllName,lpAttackDll[0]) != 0 ||
  36.                                                 wcsstr(lpwzDllName,lpAttackDll[1]) != 0 ||
  37.                                                 wcsstr(lpwzDllName,lpAttackDll[2]) != 0 ||
  38.                                                 wcsstr(lpwzDllName,lpAttackDll[3]) != 0 ||
  39.                                                 wcsstr(lpwzDllName,lpAttackDll[4]) != 0)
  40.                                         {
  41.                                                 //清零内存
  42.                                                 memset(SectionName->Buffer,0,SectionName->MaximumLength);
  43.                                         }
  44.                                 }
  45.                         }
  46.                 }__except(1){
  47.         
  48.                 }
  49.         }
  50.         return status;
复制代码

该用户从未签到

发表于 2018-6-9 23:18:12 | 显示全部楼层
不错啊,支持一下,楼主
点击按钮快速添加回复内容: 支持 高兴 激动 给力 加油 苦寻 生气 回帖 路过 感恩
您需要登录后才可以回帖 登录 | 注册账号

本版积分规则

小黑屋|手机版|Archiver|看流星社区 |网站地图

GMT+8, 2024-4-20 02:59

Powered by Kanliuxing X3.4

© 2010-2019 kanliuxing.com

快速回复 返回顶部 返回列表