Guest User

Untitled

a guest
Apr 3rd, 2012
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.37 KB | None | 0 0
  1. if (cr != check_revision_result_success)
  2.     printf("[BNCS] Error | Failed to calculate executable hash\n");
  3. else
  4. {
  5.     if (this->m_Config->ReadValue("Global", "UseExp"))
  6.     {
  7.         std::string classic_output, classic_public, xpac_output, xpac_public;
  8.  
  9.         if (hash_d2key(this->m_Config->ReadString("Global", "ClassicKey"), this->ClientToken, this->ServerToken, classic_output, classic_public))
  10.         {
  11.             if (hash_d2key(this->m_Config->ReadString("Global", "XpacKey"), this->ClientToken, this->ServerToken, xpac_output, xpac_public))
  12.             {
  13.                 Client::SID_AUTH_CHECK_ALT Pkt;
  14.  
  15.                 Pkt.ClientToken     = this->ClientToken;
  16.                 Pkt.ExeVersion      = 0x01000001;
  17.                 Pkt.ExeHash         = nHash;
  18.                 Pkt.KeyCount        = 0x02;
  19.                 Pkt.Spawn           = 0x00;
  20.  
  21.                 Pkt.KeyLengthA      = 0x10; // 16 in decimal
  22.                 Pkt.ProductA        = 0x06; // Not sure bout this, should work with 6
  23.                 Pkt.PublicA         = atoi(classic_public.c_str());
  24.                 Pkt.UnknownA        = 0x00;
  25.                
  26.                 const char* classic = classic_output.c_str();
  27.                 memcpy(&Pkt.KeyDataA[0], classic, 4);
  28.                 memcpy(&Pkt.KeyDataA[1], classic + 4, 4);
  29.                 memcpy(&Pkt.KeyDataA[2], classic + 8, 4);
  30.                 memcpy(&Pkt.KeyDataA[3], classic + 12, 4);
  31.                 memcpy(&Pkt.KeyDataA[4], classic + 16, 4);
  32.  
  33.                 Pkt.KeyLengthB      = 0x10;
  34.                 Pkt.ProductB        = 0x0A; // Product is 10
  35.                 Pkt.PublicB         = atoi(xpac_public.c_str());
  36.                 Pkt.UnknownB        = 0x00;
  37.  
  38.                 const char* xpac    = xpac_output.c_str();
  39.                 memcpy(&Pkt.KeyDataB[0], xpac, 4);
  40.                 memcpy(&Pkt.KeyDataB[1], xpac + 4, 4);
  41.                 memcpy(&Pkt.KeyDataB[2], xpac + 8, 4);
  42.                 memcpy(&Pkt.KeyDataB[3], xpac + 12, 4);
  43.                 memcpy(&Pkt.KeyDataB[4], xpac + 16, 4);
  44.  
  45.                 char* exeinfo   = this->m_Config->ReadString("Hash", "Info");
  46.                 int exe_len     = strlen(exeinfo)+1;
  47.  
  48.                 char* owner     = this->m_Config->ReadString("Global", "Owner");
  49.                 int owner_len   = strlen(owner)+1;
  50.  
  51.                 Pkt.ExeInfo     = new char[exe_len];
  52.                 Pkt.KeyOwner    = new char[owner_len];
  53.  
  54.                 memcpy(Pkt.ExeInfo, exeinfo, exe_len);
  55.                 memcpy(Pkt.KeyOwner, owner, owner_len);
  56.  
  57.                 nLength = sizeof(Client::SID_AUTH_CHECK_ALT) - 8 + exe_len + owner_len;
  58.  
  59.                 char* pBuf = new char[nLength];
  60.                 memcpy(pBuf, &Pkt, nLength);
  61.  
  62.                 this->Send(0x51, nLength, pBuf);
  63.  
  64.                 delete[] pBuf;
  65.             }
  66.             else
  67.                 printf("[BNCS] Error | Failed to hash xpac cdkey\n");
  68.         }
  69.         else
  70.             printf("[BNCS] Error | Failed to hash classic cdkey\n");
  71.     }
  72.     else
  73.     {
  74.         // classic hashing only here
  75.     }
Advertisement
Add Comment
Please, Sign In to add comment