从动态链接库中获取jmp esp地址

版权声明:本文为YuanChuang文章,未经博主允许转载。 https://blog.csdn.net/zzy1448331580/article/details/83419948
#include <windows.h>
#include <stdio.h>
int main(int,char**,char**)
{
	BYTE* pbyte;
	int nPos=0,nAddr=0;
	HINSTANCE hHinst=NULL;
	bool bTips=true;
	hHinst=LoadLibrary("user32.dll");
	if(!hHinst) return 0;
	pbyte=(BYTE*)hHinst;
	while(bTips)
	{
		if(pbyte[nPos]==0xff && pbyte[nPos+1]==0xe4)
		{
			nAddr=(int)pbyte+nPos;
			printf("address is 0x%x\n",nAddr);
			bTips=false;
         }
         else
           nPos++;
     }
     if(hHinst!=NULL) FreeLibrary(hHinst);
     return 1;
}

这段也是有错误的,比如如果一个指定的动态链接库没有jmp esp指令,那么循环就会一直下去,很可能最后引发错误,当然也可以找到很多个个动态链接库的jmp esp指令地址,只需要改一下循环,反正能用就OK了反正自己用的。

猜你喜欢

转载自blog.csdn.net/zzy1448331580/article/details/83419948