您当前的位置: 首页 > 

一个小巧的反汇编引擎

发布时间:2012-12-02 21:12:06 ,浏览量:0

    从内核反汇编hook中截取的反汇编代码,非常小巧:

#include 
#include 
#include 
//#include 
#include "libdasm.h"

typedef unsigned char byte;
byte bin[] = {0x55,0x89,0xE5,0x83,0xEC,0x08,0xC7,0x04,\
				0x24,0x01,0x00,0x00,0x00,0xFF,0x15,0xDC,\
				0x40,0x40,0x00,0xE8,0x88,0xFF,0xFF,0xFF};

#define SZINST_MAX 128

int main(void)
{
	INSTRUCTION inst;
	char szinst[SZINST_MAX];
	byte *pbin = bin;
	byte *offset = (byte*)0x401220;
	do
	{
		int ret0 = get_instruction(&inst,pbin,MODE_32);
		pbin += ret0;
		if(!get_instruction_string(&inst,FORMAT_INTEL,\
			(DWORD)offset,szinst,sizeof(szinst)))
		{
			puts("err : can't to string???");
		}
		offset += ret0;
		printf("code is :: %s\n",szinst);
	}while(pbin < bin+sizeof(bin));
	
	getchar();
	return 0;
}

输出: code is :: push ebp code is :: mov ebp,esp code is :: sub esp,0x8 code is :: mov dword [esp],0x1 code is :: call [0x4040dc] code is :: call 0x4011c0
关注
打赏
1688896170
查看更多评论

暂无认证

  • 0浏览

    0关注

    107766博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文
立即登录/注册

微信扫码登录

0.0456s