I made a DLL that hooks the send function of an MMORPG game. When the send()
function is called, it will send the packet in a loop until I stop it instead of just sending the packet one time.
My problem is the packets are encrypted. And, the server checks every packet sent from the client. If the packet that the server expect does not match from what the client sent, the server will disconnect you. So, even if you disable the encryption code in the client, it will still get verified on the server side.
I manage to disable the encryption of the packet by modifying the binary but I still get disconnected because of the above statement. And, I can't send it in an infinite loop because each packet should be different.
Info:
- Only the packets sent from client to server are encrypted. The packets from server to client are not encrypted.
- Only the first 2 bytes of the packet is encrypted. The remaining 8 bytes are not. The size of the packet is 10 bytes.
- I found the function (written in assembly) where it generates the dynamic key used to encrypt the first 2 bytes. I wanted to use that codes but I don't know how to translate them into a higher level language like c++.
Decryption Function
unsigned short clif_decrypt_cmd( int cmd, struct map_session_data *sd ) {
if (sd) {
return (cmd ^ ((sd->cryptKey >> 16) & 0x7FFF));
}
return (cmd ^ ((((clif->cryptKey[0] * clif->cryptKey[1]) + clif->cryptKey[2]) >> 16) & 0x7FFF));
}
Question:
- How can I achieve my goal to send the packet in an infinite loop if each packet is checked by the server?
- Should I use the function that encrypts the first two bytes before sending each time I send it?