So the module handles the 0x04 packet as well? Doesn't seem to work for me though
These are my results:
[02:13:30] [127.0.0.1:2307] CMSG_WARDEN_DATA [MAIEV_RESPONSE_HASH]
[02:13:30] [127.0.0.1:2307] DEBUG: Packet Dump - Length=21
| 04 68 B3 66 7C 9C F3 0E D1 F3 00 59 73 2D DB 49 | ♦h?f|??♫?? Ys-?I |
| 05 74 55 24 A3 | ♣tU$? |
[02:13:30] Hash1: 0x68B3667C9CF30ED1F30059732DDB4905745524A3
[02:13:30] [WARDEN] m_ModMem = 0x1D1884 k = 0x5004764 k_len = 40!
Warden.GetRC4Data() Buffer=1906852, Size=520
[02:13:30] [127.0.0.1:2307] DEBUG: Packet Dump - Length=17
| 05 4E 00 23 34 3D 83 3B 45 DE 29 7E 9F 42 8C FD | ♣N #4=?;E?)~?B?? |
| 54 | T |
Warden.SendPacket() ptrPacket=113506188, size=21
[02:13:30] [127.0.0.1:2307] DEBUG: Packet Dump - Length=21
| 04 B2 DE A0 95 A9 C8 BB F6 45 68 8B 51 D6 CF 75 | ♦????????Eh?Q??u |
| BE F5 E3 A0 BA | ????? |
[02:13:30] Hash2: 0xB2DEA095A9C8BBF645688B51D6CF75BEF5E3A0BA
As you can see, Hash2 (server calculated) differs from Hash1 (client calculated).
And therefore the keys are also invalid. But I've finally got the hash to be static.
This is how I do it:
GenerateRC4Keys(ModuleFuncTable, K, K.length);
PacketHandler(ModuleFuncTable, PacketData, PacketData.length, BytesRead);
And for the GetRC4Data callback, it's now the same as you posted. Thanks to that, the hash never changes as it should.
And the SendPacket is no need to go into since it's just copying of bytes.
And btw, I no longer encrypt the data that is sent into the packet handler and decrypting the return packet since it looks like you didn't do that.
Do I need to do something more to the hash I just returned? And what is this 0x04 packet handler you're talking about? Is it the return packet from 0x05?
Edit: No success with the keys from the public byte[] ReadRC4Data function.