运行shellcode + vs2010 [英] running shellcode + vs2010

查看:249
本文介绍了运行shellcode + vs2010的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚尝试了以下代码段以进行shellcode测试:-

I just tried the following code snippet for shellcode testing purposes:-

#include<iostream>

using namespace std;

char sc[] = ""; #i've removed the shellcode
int main() {
    int (*func)();
    func = (int(*)())sc;
    (int)(*func)();
}

我在编译时遇到构建错误:-

I get a build error on compilation :-

------ Build started: Project: shellcoderunner, Configuration: Debug Win32 ------
Build started 10/15/2011 12:51:16 PM.
InitializeBuildStatus:
  Touching "Debug\shellcoderunner.unsuccessfulbuild".
ClCompile:
  blah.cpp
c:\users\reverser\documents\visual studio 2010\projects\shellcoderunner\shellcoderunner\blah.cpp(7): error C2440: 'type cast' : cannot convert from 'char [149]' to 'int (__cdecl *)(void)'
          There is no context in which this conversion is possible

Build FAILED.

Time Elapsed 00:00:01.99
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

明显是我做错了吗?

推荐答案

要使用VS在您的C/C ++程序中执行shellcode,最简单的方法是将汇编代码嵌入如下例所示:

To execute a shellcode in your C/C++ program with VS, the simplest way is embedding an Assembly code like this example below:

char* buffer="blah blah blah";
int main() {
    __asm{
        lea eax, buffer
        call    eax
    }
}

希望获得帮助!

这篇关于运行shellcode + vs2010的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆