Archived

This topic is now archived and is closed to further replies.

Editing packets

This topic is 4994 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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 ?

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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)

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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:


  
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.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
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

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites

This topic is 4994 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Guest
This topic is now closed to further replies.