Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if (cr != check_revision_result_success)
- printf("[BNCS] Error | Failed to calculate executable hash\n");
- else
- {
- if (this->m_Config->ReadValue("Global", "UseExp"))
- {
- std::string classic_output, classic_public, xpac_output, xpac_public;
- if (hash_d2key(this->m_Config->ReadString("Global", "ClassicKey"), this->ClientToken, this->ServerToken, classic_output, classic_public))
- {
- if (hash_d2key(this->m_Config->ReadString("Global", "XpacKey"), this->ClientToken, this->ServerToken, xpac_output, xpac_public))
- {
- Client::SID_AUTH_CHECK_ALT Pkt;
- Pkt.ClientToken = this->ClientToken;
- Pkt.ExeVersion = 0x01000001;
- Pkt.ExeHash = nHash;
- Pkt.KeyCount = 0x02;
- Pkt.Spawn = 0x00;
- Pkt.KeyLengthA = 0x10; // 16 in decimal
- Pkt.ProductA = 0x06; // Not sure bout this, should work with 6
- Pkt.PublicA = atoi(classic_public.c_str());
- Pkt.UnknownA = 0x00;
- const char* classic = classic_output.c_str();
- memcpy(&Pkt.KeyDataA[0], classic, 4);
- memcpy(&Pkt.KeyDataA[1], classic + 4, 4);
- memcpy(&Pkt.KeyDataA[2], classic + 8, 4);
- memcpy(&Pkt.KeyDataA[3], classic + 12, 4);
- memcpy(&Pkt.KeyDataA[4], classic + 16, 4);
- Pkt.KeyLengthB = 0x10;
- Pkt.ProductB = 0x0A; // Product is 10
- Pkt.PublicB = atoi(xpac_public.c_str());
- Pkt.UnknownB = 0x00;
- const char* xpac = xpac_output.c_str();
- memcpy(&Pkt.KeyDataB[0], xpac, 4);
- memcpy(&Pkt.KeyDataB[1], xpac + 4, 4);
- memcpy(&Pkt.KeyDataB[2], xpac + 8, 4);
- memcpy(&Pkt.KeyDataB[3], xpac + 12, 4);
- memcpy(&Pkt.KeyDataB[4], xpac + 16, 4);
- char* exeinfo = this->m_Config->ReadString("Hash", "Info");
- int exe_len = strlen(exeinfo)+1;
- char* owner = this->m_Config->ReadString("Global", "Owner");
- int owner_len = strlen(owner)+1;
- Pkt.ExeInfo = new char[exe_len];
- Pkt.KeyOwner = new char[owner_len];
- memcpy(Pkt.ExeInfo, exeinfo, exe_len);
- memcpy(Pkt.KeyOwner, owner, owner_len);
- nLength = sizeof(Client::SID_AUTH_CHECK_ALT) - 8 + exe_len + owner_len;
- char* pBuf = new char[nLength];
- memcpy(pBuf, &Pkt, nLength);
- this->Send(0x51, nLength, pBuf);
- delete[] pBuf;
- }
- else
- printf("[BNCS] Error | Failed to hash xpac cdkey\n");
- }
- else
- printf("[BNCS] Error | Failed to hash classic cdkey\n");
- }
- else
- {
- // classic hashing only here
- }
Advertisement
Add Comment
Please, Sign In to add comment