openkore icon indicating copy to clipboard operation
openkore copied to clipboard

map server how to get 3 keys

Open lowfiend opened this issue 10 years ago • 2 comments

TWRO is updating map 3keys , how can I get cryptKeys? Use PE Viewer? thanks.

lowfiend avatar Jun 30 '16 07:06 lowfiend

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

cydh avatar Jul 07 '16 02:07 cydh

sorry, how we can get the 3 cryptkey with your counter decrypt method ?

Razalka avatar Mar 09 '17 06:03 Razalka