0755mx 发表于 2015-5-19 13:58:15

win7下测试shellcode的方法2:设置数据段为可执行

  在win7下,通过下面的方法测试shellcode:



char shellcode [] ="..." ;
int main ( int argc , char ** argv)
{
__asm
{
lea   eax , shellcode
call eax
}
return 0;
}

  必须要也可以通过设置数据段为可执行来测试shellcode,不然shellcode所在的数据段由于受系统保护不允许被执行,导致出现异常,而测试失败。
  代码如下:



#pragma comment(linker, "/section:.data,RWE") //这句话是关键,设置数据段为可执行
char shellcode [] ="..." ;
int main ( int argc , char ** argv)
{
__asm
{
lea   eax , shellcode
call eax
}
return 0;
}

  
页: [1]
查看完整版本: win7下测试shellcode的方法2:设置数据段为可执行