您的位置:首页 > 其它

利用detours劫持自己的系统函数

2015-08-12 17:08 525 查看

//劫持自己

#include<stdio.h>

#include<stdlib.h>

#include<Windows.h>

#include<string.h>

#include "detours.h"

#pragma comment(lib,"detours.lib")

static int(*poldsystem)(const char * _Command) = system;

int newsystem(const char * _Command)

{

//禁止tasklist

char *p = strstr(_Command, "tasklist");

if (p == NULL)

{

poldsystem(_Command);

}

else

{

printf("%stasklist禁止执行", _Command);

return 0;

}

}

void Hook()

{

DetourRestoreAfterWith();

DetourTransactionBegin();

DetourUpdateThread(GetCurrentThread);

DetourAttach((void**)&poldsystem,newsystem);

DetourTransactionCommit();

}

void main()

{

system("calc");

Hook();

system("calc");

system("tasklist");

getchar();

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: