反调试学习

1、PEB反调试

	BeingDebugged :1
	NtGlobalFlag :0x70

```cpp
#include "..//ntdll//ntdll.h"//导入ntdll.h头文件
#pragma comment(lib, "..//ntdll//ntdll_x86.lib")//静态链接库
#define OUTMESSAGE(a,b) printf("%-36s %s\n",a,b ? "Being debuged":"Running Normal!")//定义一个宏显示调试信息
void test()
{
	PEB *peb;
	BOOL bl = FALSE;
	_asm
	{//FS:[0x30]获取peb的地址
		mov eax, dword ptr fs : [0x30]
		mov peb,eax
	}

	if (peb->BeingDebugged)
	{
		bl = TRUE;
	}
	if (peb->NtGlobalFlag & 0x70)
	{
		bl = TRUE;
		
	}
	OUTMESSAGE(__FUNCTION__, bl);
}

2 IsDebuggerPresent

IsDebuggerPresent函数检测,被调试时返回1

void _IsDebugPresent()
{
	BOOL bl = FALSE

猜你喜欢

转载自blog.csdn.net/haodawei123/article/details/103585138
今日推荐