Editing packets
how can i recive packets that are meent for my server.exe ?
i have client.exe
and server.exe
they send packets bettween each other and i want to pick em out and modefy em: so i can test if my system is nearly cheat free
+ some debug things
how can i do that ?
- Me
Well if your talking about packet identifycation, then i''ve got just the solution. When reading my book "Multiplayer Game Programming" by Todd Barron, i was reading the networking library and i found how they used MS uses DirectPlay. Well dPlay does something like this.
class GenPacket
{
DWORD dwSize;
DWORD dwType;
};
class WhatEverYouWant : public GenPacket
{
char userName[64];
};
//SERVER SIDE
char *rawData;
GenPacket *PGen;
WhatEverYouWant *recvData;
recv(connectedSocket,rawData,32768,0);
// cast the data into something u can read
PGen = (GenPacket*)rawData;
//check its type
if(PGen->dwType == WHATEVERYOUWANT)
{
//cast it to the packet that is really is...
recvData = (WhatEverYouWant*)rawData;
cout << "UserName: " << recvData->userName << "\n";
}
I hope to hear from you soon...it *should* work
class GenPacket
{
DWORD dwSize;
DWORD dwType;
};
class WhatEverYouWant : public GenPacket
{
char userName[64];
};
//SERVER SIDE
char *rawData;
GenPacket *PGen;
WhatEverYouWant *recvData;
recv(connectedSocket,rawData,32768,0);
// cast the data into something u can read
PGen = (GenPacket*)rawData;
//check its type
if(PGen->dwType == WHATEVERYOUWANT)
{
//cast it to the packet that is really is...
recvData = (WhatEverYouWant*)rawData;
cout << "UserName: " << recvData->userName << "\n";
}
I hope to hear from you soon...it *should* work
"There are no such things as stupid questions...Just stupid people :)"-Me
i want to hijack & edit packets that are going to a other app than my own ...
- Me
You can view the packets by using a packet sniffer to read all traffic on the "wire."
To edit the packets you will have to intercept the receive function in the client program. This requires hooking into the process space and inserting a jump to your packet receive function for modification. This is very intensive and takes a lot of programming effort.
A guy by the name of Madshi has a library that makes it a bit easier.
You also need to check into dissassemblers as well since you will need those to find the symbolic function names of the functions you wish to intercept. You also need to be handy with assembly language.
LostLogic
www.lostlogic.com
Author, Multiplayer Game Programming
Author, Strategy Game Programming with Direct X 9 (Not yet released)
To edit the packets you will have to intercept the receive function in the client program. This requires hooking into the process space and inserting a jump to your packet receive function for modification. This is very intensive and takes a lot of programming effort.
A guy by the name of Madshi has a library that makes it a bit easier.
You also need to check into dissassemblers as well since you will need those to find the symbolic function names of the functions you wish to intercept. You also need to be handy with assembly language.
LostLogic
www.lostlogic.com
Author, Multiplayer Game Programming
Author, Strategy Game Programming with Direct X 9 (Not yet released)
LostLogicwww.GamerOutfit.comXBox 360 Community Games Reviews and NewsExisled - 2D/3D Shooter for XBox 360
The Windows API provides functions that you can use to help hook functions. For instance, you can set up a DLL that is loaded into every program that starts, and checks the name of the program and exits until it finds the "server" program. At that point, it can remap the Winsock recv(from) to a custom function that does what it needs to, then passes the call onto the Winsock DLL. A good example in Decal from Asheron''s Call. It hooks Winsock to intercept all packets coming in and out of Asheron''s Call, and hooks Direct3D to display a GUI inside the game itself. Goto decaldev.sourceforge.net for the code. Its a little hard to follow at first since its all ATL, but concentrate on the inject.dll.
could u by chance offer any example code or snippets to help explain what you are saying?
THX
THX
"There are no such things as stupid questions...Just stupid people :)"-Me
It''s hard to post a specific example since the actual code spawns multiple files, but hooking just Winsock shouldn''t be too hard. One thing you could try, would be to put a custom copy of the Winsock DLL in your program''s running directory. Code a DLL that has all the same functions as the real Winsock, but just pass the calls directly to the real Winsock DLL, except for recvfrom, which you would pass off to the real Winsock DLL, read/edit the return data, then pass back to your application.
This method requires you to dynamically link to the real winsock and writing the definitions for all the Winsock functions can be a huge pain. In the recvfrom function, for example:
WS_recvfrom is just the dynamically created pointed to the real recvfrom function in the real DLL. Just use GetProcAddress with each Winsock function to get the pointer. If you need to know how to dynamically load DLLs, just ask and I can try to explain it a bit better.
This method requires you to dynamically link to the real winsock and writing the definitions for all the Winsock functions can be a huge pain. In the recvfrom function, for example:
int recvfrom(...){ int result; result = WS_recvfrom(...); // Process the returned packet from the real recvfrom call. return result;}
WS_recvfrom is just the dynamically created pointed to the real recvfrom function in the real DLL. Just use GetProcAddress with each Winsock function to get the pointer. If you need to know how to dynamically load DLLs, just ask and I can try to explain it a bit better.
April 15, 2004 01:58 AM
i was wondering if any of you could do me a favor since you are all really good at this please email me at satanstheory@hotmail.com thanx
quote:
Original post by CoMaNdore
i want to hijack & edit packets that are going to a other app than my own ...
what game are you trying to cheat at?
--- krez ([email="krez_AT_optonline_DOT_net"]krez_AT_optonline_DOT_net[/email])
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement