频道栏目
首页 > 资讯 > 系统安全 > 正文

从汇编代码提取Shellcode的简单实现

10-12-02        来源:[db:作者]  
收藏   我要投稿

#include <stdio.h>

unsigned char *asm_code()
{
__asm
{
   lea eax,__code
   jmp __ret
}

//这里放shellcode的汇编代码
__asm
{
__code:
xor     ebx, ebx                         ; test.00405030
push    ebx
push    4B435546h
mov     eax, esp
push    ebx
push    eax
push    eax
push    ebx
mov     eax, 77E18098h
call    eax
mov     eax, 77E6E01Ah
push    ebx
call    eax
}


//函数结语
__asm int 3
__asm { __ret: }
}

void main()
{
unsigned char temp;
int i = 1;
unsigned char *asm_p = asm_code();
FILE *fd = fopen("code.txt","w");
fprintf(fd,"unsigned char shellcode = "");
while((temp = *asm_p) != 0xcc)
{
   fprintf(fd,"\x%.2x",temp);
   asm_p ++;
   if(i % 8 == 0) fprintf(fd,"" "");
   i ++;
}
fprintf(fd,"";");
fclose(fd);
}


生成的code.txt:

‍unsigned char shellcode = "x33xdbx53x68x46x55x43x4b"
"x8bxc4x53x50x50x53xb8x98"
"x80xe1x77xffxd0xb8x1axe0"
"xe6x77x53xffxd0";

相关TAG标签
上一篇:SA权限沙盘模式提权方法
下一篇:对就爱设计网站官方的再次突破
相关文章
图文推荐

关于我们 | 联系我们 | 广告服务 | 投资合作 | 版权申明 | 在线帮助 | 网站地图 | 作品发布 | Vip技术培训 | 举报中心

版权所有: 红黑联盟--致力于做实用的IT技术学习网站