Questionpacket redirection

Posts 1–2 of 2 · Page 1 of 1
packet redirection
alright so I've had a fair bit of c++ experience with offline applications and opengl rendering but i was wondering if anyone had any tutorials for packet editing or eBooks they know of which could help in learning this im kind of wanting to extend my knowledge of c++ for future references and i haven't messed with packets and packet redirection with c++ before (iv'e messed around with it a little in vb and asm) but i generally prefer c++ so any help would be appreciated
Using a winsock hook you can hook the send() and recv() or w/e functions the game uses to send and recieve packets then do what you want with them (edit, read out, etc)
Code:
	HMODULE ws2_32 = NULL;
		while(!ws2_32)
		{
			ws2_32 = GetModuleHandleA("ws2_32.dll");
			Sleep(10);
		}
		osend = (r_send)GetProcAddress(ws2_32, "send");
		orecv = (r_recv)GetProcAddress(ws2_32, "recv");
		oconnect = (r_connect)GetProcAddress(ws2_32, "connect");
		oWSASendTo = (r_WSASendTo)GetProcAddress(ws2_32, "WSASendTo");
		oWSARecvFrom = (r_WSARecvFrom)GetProcAddress(ws2_32, "WSARecvFrom");
		oWSASend = (r_WSASend)GetProcAddress(ws2_32, "WSASend");
		oWSARecv = (r_WSARecv)GetProcAddress(ws2_32, "WSARecv");
		ogethostbyname = (r_gethostbyname)GetProcAddress(ws2_32, "gethostbyname");
		osendto = (r_sendto)GetProcAddress(ws2_32, "sendto");
		orecvfrom = (r_recvfrom)GetProcAddress(ws2_32, "recvfrom");

		osend = (r_send)DetourFunc((BYTE*)osend, (BYTE*)&custom_send, 5); 
		orecv = (r_recv)DetourFunc((BYTE*)orecv, (BYTE*)&custom_recv, 5);
		oconnect = (r_connect)DetourFunc((BYTE*)oconnect, (BYTE*)&custom_connect, 5);
		oWSASend = (r_WSASend)DetourFunc((BYTE*)oWSASend, (BYTE*)&custom_WSASend, 5);
		oWSASendTo = (r_WSASendTo)DetourFunc((BYTE*)oWSASendTo, (BYTE*)&custom_WSASendTo, 5);
		oWSARecvFrom = (r_WSARecvFrom)DetourFunc((BYTE*)oWSARecvFrom, (BYTE*)&custom_WSARecvFrom, 5);
		oWSARecv = (r_WSARecv)DetourFunc((BYTE*)oWSARecv, (BYTE*)&custom_WSARecv, 5);
		ogethostbyname = (r_gethostbyname)DetourFunc((BYTE*)ogethostbyname, (BYTE*)&custom_gethostbyname, 5);
		osendto = (r_sendto)DetourFunc((BYTE*)osendto, (BYTE*)&custom_sendto, 5);
		orecvfrom = (r_recvfrom)DetourFunc((BYTE*)orecvfrom, (BYTE*)&custom_recvfrom, 5);
That's some of my code for my winsock hook
Posts 1–2 of 2 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Need help?