Packet [0x0204] -- Client Hash Check

Forum closed. All further discussion to be discussed at https://github.com/OpenKore/

Moderator: Moderators

Message
Author
User avatar
kLabMouse
Administrator
Administrator
Posts: 1301
Joined: 24 Apr 2008, 12:02

Packet [0x0204] -- Client Hash Check

#1 Post by kLabMouse »

Description:
Packet sent to Login (Account) server on Login state just after connect.
Analysis show, that packet is specified only Sakray servers, and may-be a few Normal servers.

Packet seen in Wild: YES!
(ToDo: Check g_serviceType and g_serverType, thous servers use it)

Structure:

Code: Select all

struct PACKET_CA_EXE_HASHCHECK {
  short PacketType;
  unsigned char HashValue[16];
}
Generation Code:

Code: Select all

/*
struct PACKET_CA_EXE_HASHCHECK {
  short PacketType;
  unsigned char HashValue[16];
}
*/
private: void __thiscall CLoginMode::CheckExeHashFromAccServer() {
  bool send_hash = false;
  if ((g_serviceType == 6)||((! g_serviceType)&&(g_serverType == 1))) {
    send_hash = true;
  };
  PACKET_CA_EXE_HASHCHECK pHashCheck;
  pHashCheck.PacketType = 0x0204;
  if (send_hash) {
    MD5 exehash;
    char szFile[260];
    exehash->init();
    GetModuleFileNameA(g_hInstance, *szFile, 260);
    FILE *fFile = fopen(*szFile, "rb"); 
    if (fFile == NULL ) return;
    while( !feof( fFile ) ) {
      unsigned char btFile[1024];
      exehash->append(*btFile, fread(*btFile, 1, 1024, fFile));
    };
    exehash->finish(*(pHashCheck.HashValue));
    unsigned char MainHash[16] = { 0x65, 0xE3, 0x64, 0x31, 0x03, 0x1C, 0x03, 0x11, 0x1E, 0x50, 0x6D, 0x13, 0x39, 0x69, 0x2D, 0x7A };
    unsigned char SakHash[16] = { 0x82, 0xD1, 0x2C, 0x91, 0x4F, 0x5A, 0xD4, 0x8F, 0xD9, 0x6F, 0xCF, 0x7E, 0xF4, 0xCC, 0x49, 0x2D };
    if (! g_serviceType) {
      if (g_serverType == 1) {
        pHashCheck.HashValue = SakHash;
      } else if (! g_serverType) {
        pHashCheck.HashValue = MainHash;
      } else {
        pHashCheck.HashValue = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
      };
    } else if (g_serviceType == 6) {
      if (g_serverType == 1) {
        unsigned char SakHash[16] = { 0xC7, 0x0A, 0x94, 0xC2, 0x7A, 0xCC, 0x38, 0x9A, 0x47, 0xF5, 0x54, 0x39, 0x7C, 0xA4, 0xD0, 0x39 };
        pHashCheck.HashValue = SakHash;
      };
    };
    CRagConnection::instanceR->SendPacket(CRagConnection::instanceR->GetPacketSize(pHashCheck.PacketType), *pHashCheck);
  };
}

Locked