Code:
#include "stdafx.h"
#include <stdio.h>
#include <Winsock2.h>
#include <windows.h>
#include <iostream>
#include <fstream>
#include <string>
#pragma comment(lib,"detours.lib")
#include "detours.h"
#pragma comment(lib, "ws2_32.lib")
static int(WINAPI *orig_send)(SOCKET s,const char*buf,int len,int flags)=send;
int WINAPI my_send(SOCKET s,const char*buf,int len,int flags)
{
printf("Paket gesendet..\n");
return orig_send(s, buf,len, flags);
}
int WINAPI konsol()
{
AllocConsole();
AttachConsole(GetCurrentProcessId());
freopen("con","w",stdout);
return 0;
}
BOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
MessageBoxA(0,"Haken Injected",0,0);
konsol();
DetourTransactionBegin();
DetourUpdateThread(GetCurrentThread());
DetourAttach(&(PVOID&)orig_send, my_send);
DetourTransactionCommit();
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}






