openkore
openkore copied to clipboard
map server how to get 3 keys
TWRO is updating map 3keys , how can I get cryptKeys? Use PE Viewer? thanks.
Maybe...
In emulator we call it Obfuscation Keys, defined in clients. And for the encryption, you can "counter-decrypt" from @rAthena https://github.com/rathena/rathena/blob/master/src/map/clif.c#L18094-L18105
static unsigned short clif_parse_cmd(int fd, struct map_session_data *sd) {
#ifndef PACKET_OBFUSCATION
return RFIFOW(fd, 0);
#else
unsigned short cmd = RFIFOW(fd,0); // Check if it is a player that tries to connect to the map server.
if (sd)
cmd = (cmd ^ ((sd->cryptKey >> 16) & 0x7FFF)); // Decrypt the current packet ID with the last key stored in the session.
else
cmd = (cmd ^ ((((clif_cryptKey[0] * clif_cryptKey[1]) + clif_cryptKey[2]) >> 16) & 0x7FFF)); // A player tries to connect - use the initial keys for the decryption of the packet ID.
return cmd; // Return the decrypted packet ID.
#endif
}
or from @HerculesWS
sorry, how we can get the 3 cryptkey with your counter decrypt method ?