首页
社区
课程
招聘
[原创]Minlink Engine V1.0
发表于: 2012-9-4 12:10 13026

[原创]Minlink Engine V1.0

2012-9-4 12:10
13026

RT.顺便妹子.
简介一下几个函数.没使用反汇编引擎,因此遇到特定的指令序列的时候会出错.测试了10个程序左右.我运气好,只有一个出错了.
计算对其值.

unsigned long alignment(unsigned long size,unsigned long align)
{
	if(size%align!=0)
		return  (size/align+1)*align;
	return size;
}
void _link_push_imm(void * dst,size_t _new_push_rva,void * src,size_t _code_push_rva,size_t _image_base_offset)
{
	/*
	    jmp     xxxxxxxx
        sub     esp, 4
        mov     dword ptr [esp], -1
        jmp     FFFFFFFF
	*/
	unsigned char _rand_reg[] = {0x50, 0x51, 0x52, 0x53, 0x53, 0x54, 0x55, 0x56, 0x57};
	unsigned char push[] = {0x50, 
		                    0xC7, 0x04, 0x24, 0x00, 0x00, 0x00, 0x00, 
                            0xE9, 0x00, 0x00, 0x00, 0x00};
	unsigned char * pdst = (unsigned char *) dst;
	unsigned char * psrc = (unsigned char *) src;
	unsigned long _next_opcode_va = ((unsigned long)psrc + 5 + _code_push_rva + _image_base_offset);
	if(*psrc == 0x68)
	{
		/*mov     dword ptr [esp], xxxxxxxx*/
		memmove(push + 4,psrc + 1,sizeof(unsigned long));
		int index = clock() % 9;
		memset(push,_rand_reg[index],sizeof(unsigned char));
		/*jmp     xxxxxxxx*/
		memset(psrc,0xE9,sizeof(unsigned char));
	    *(unsigned long *) (psrc + 1)  = (unsigned long) (pdst + _new_push_rva + _image_base_offset - _next_opcode_va);
		/*jmp     xxxxxxxx*/
		*(unsigned long *)(push + 9) = (_next_opcode_va - ((unsigned long)pdst + 8 + _new_push_rva  + _image_base_offset + 5));
		memmove(pdst,push,0xD);
	}
}
void _link_call_mem(void * dst,size_t _new_push_rva,void * src,size_t _code_push_rva,size_t _image_base_offset)
{
	unsigned long _next_address = 0;
	unsigned char _rand_reg[] = {0x50, 0x51, 0x52, 0x53, 0x53, 0x54, 0x55, 0x56, 0x57};
	unsigned char call[] = {0x50, 
		                    0xC7, 0x04, 0x24, 0x00, 0x00, 0x00, 0x00, 
		                    0xFF, 0x25, 0x00, 0x00, 0x00, 0x00, 
		                    0xE9, 0x00, 0x00, 0x00, 0x00};
	unsigned char * pdst = (unsigned char *) dst;
	unsigned char * psrc = (unsigned char *) src;
	unsigned long _next_opcode_va = ((unsigned long)psrc + 5 + _code_push_rva + _image_base_offset);

	if(*(unsigned short *)psrc == 0x15ff)
	{
		Sleep(1);
		int index = rand() % 9;
		memset(call,_rand_reg[index],sizeof(unsigned char));
		memmove(call + 10,psrc + 2,sizeof(unsigned long));

		memset(psrc,0xE9,sizeof(unsigned char));
		*(unsigned long *) (psrc + 1)  = (unsigned long) (pdst + _new_push_rva + _image_base_offset - _next_opcode_va);
		memset(psrc + 5,0x90,sizeof(unsigned char));
		/*mov     dword ptr [esp], -1*/
		_next_address = (unsigned long) ((unsigned long)pdst + 14 + _new_push_rva  + _image_base_offset);
		memmove((void *)(call + 4),(void *)&_next_address,sizeof(unsigned long));
		_next_address = (unsigned long) (_next_opcode_va - ((unsigned long)pdst + 14 + _new_push_rva  + _image_base_offset + 5));
		memmove((void *)(call + 15),(void *)&_next_address,sizeof(unsigned long));
		memmove(pdst,call,19);
	}
}

[招生]科锐逆向工程师培训(2024年11月15日实地,远程教学同时开班, 第51期)

收藏
免费 7
支持
分享
最新回复 (11)
雪    币: 1844
活跃值: (35)
能力值: ( LV3,RANK:30 )
在线值:
发帖
回帖
粉丝
2
嗯,还真的要和反汇编引擎配合一下的,做出来的效果可以复杂很多
2012-9-4 12:55
0
雪    币: 287
活跃值: (583)
能力值: ( LV5,RANK:60 )
在线值:
发帖
回帖
粉丝
3
无法学习,只能膜拜
2012-9-4 13:22
0
雪    币: 27
活跃值: (127)
能力值: ( LV8,RANK:120 )
在线值:
发帖
回帖
粉丝
4
2012-9-4 16:25
0
雪    币: 19
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
5
过来围观lz,看来lz最近在研究代码变形~
2012-9-4 17:26
0
雪    币: 1895
活跃值: (1657)
能力值: ( LV5,RANK:60 )
在线值:
发帖
回帖
粉丝
6
VM解析贴一出,各种代码变形随之而出。
2012-9-5 12:37
0
雪    币: 4902
活跃值: (130)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
7
速度赶来学习了
2012-9-5 12:54
0
雪    币: 142
活跃值: (310)
能力值: ( LV4,RANK:40 )
在线值:
发帖
回帖
粉丝
8
楼主竟然是个妹纸,高手啊,求联系方式。
2012-9-6 09:19
0
雪    币: 120
活跃值: (160)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
9
楼主还木有男盆友。。你得抓紧了。。。我看过PP的,一个字:“灰常漂亮”
2012-9-6 09:44
0
雪    币: 287
活跃值: (583)
能力值: ( LV5,RANK:60 )
在线值:
发帖
回帖
粉丝
10
我这有LZMM的QQ,我便宜卖你,要不要啊
2012-9-6 10:38
0
雪    币: 1689
活跃值: (379)
能力值: ( LV15,RANK:440 )
在线值:
发帖
回帖
粉丝
11
她终于答应作我女朋友了.幸运。
2012-9-7 08:52
0
雪    币: 8835
活跃值: (2404)
能力值: ( LV12,RANK:760 )
在线值:
发帖
回帖
粉丝
12
都是这些坏淫~
2012-9-8 19:46
0
游客
登录 | 注册 方可回帖
返回
//