WPE - Need help

06/10/2016 23:43 Activityzz#1
Hello everyone,
First, sorry for my english, i'm French but none website like this exist in language.

So, i use WPE (packet editor) with a friend in "Wakfu", a french MMORPG.
We have a problem, we want to start the fight with monster with WPE, but we can't actually, because in the packet of the start of fight, you need to have the ID of mob, this ID is placed on a "receive" packet when you enter in the room.
So, my question is, can i code a packet editor who read automaticaly the receive packet, find in the good packet the ID of the mob and send automaticaly a packet with this ID on for start the fight.
Exemple: The ID of the mob is "MM MM", this ID, on receive packed is alwais after a sentence like " FF FF FF 00".
So, i receive a packet with that in "FF FF FF 00 MM MM":
I want code something for detect "FF FF FF 00", take the 4 caracter after "MM MM", insert this in a send packet like "AE BC XX XX 00 FF" --> "AE BC MM MM 00 FF" and send automaticaly.

That is possible ?
Thx for read this horrible post writed by a noob french :p
06/16/2016 18:36 elmarcia#2
U need detours lib
Not my code, i commented what is needed to do
Code:
#include <windows.h>
#include <detours.h>
#pragma comment(lib, "ws2_32.lib")

DETOUR_TRAMPOLINE(int WINAPI send_detour(SOCKET s, const char *buf, int len, int flags), send);
DETOUR_TRAMPOLINE(int WINAPI recv_detour(SOCKET s, const char *buf, int len, int flags), recv);

int WINAPI send_hook(SOCKET s, const char *buf, int len, int flags){
	//MessageBox(NULL, buf, "send", MB_OK);
	
return send_detour(s, buf, len, flags);
}

int WINAPI recv_hook(SOCKET s, const char *buf, int len, int flags){
//	MessageBox(NULL, buf, "recv", MB_OK);
//if compareWithWhatIWant(buf) {send_hook(s,mySend,sizeof(mySend),flags}
	return recv_detour(s, buf, len, flags);
}

BOOL APIENTRY DllMain(HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved){
	switch(ul_reason_for_call){
		case DLL_PROCESS_ATTACH:
			DetourFunctionWithTrampoline((PBYTE)send_detour, (PBYTE)send_hook);
			DetourFunctionWithTrampoline((PBYTE)recv_detour, (PBYTE)recv_hook);
			break;

		case DLL_PROCESS_DETACH:
			DetourRemove((PBYTE)send_detour, (PBYTE)send_hook);
			DetourRemove((PBYTE)recv_detour, (PBYTE)recv_hook);
			break;
	}

	return TRUE;
}