Advertisement
Guest User

Untitled

a guest
Mar 15th, 2019
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.79 KB | None | 0 0
  1. void MainWindow::on_pushButton_clicked()
  2. {
  3. secondwindow sw;
  4. string Username = ui->lineEdit_username->text().toStdString().c_str();
  5. string Password = ui->lineEdit_password->text().toStdString().c_str();
  6. Username += ":" + Password;
  7. bool status = Client.connect();
  8. if (status == true)
  9. {
  10. char beginningkey[6] = { DELETED SO MY CLIENT DOESNT GET CRACKED};
  11. char newkey[9];
  12. string encrypted = Lic.XorEncrypt("start", beginningkey);
  13. string encrypted_hex = Lic.string_to_hex(encrypted);
  14. Client.write(encrypted_hex);
  15. string str_newkey_hex = Client.read();
  16. string str_newkey_encrypted = Lic.hex_to_string(str_newkey_hex);
  17. string str_newkey_decrypted = Lic.XorEncrypt(str_newkey_encrypted, beginningkey);
  18. cout << str_newkey_decrypted << endl;
  19. std::memcpy(newkey, str_newkey_decrypted.c_str(), str_newkey_decrypted.size() + 1);
  20. string Username_encrypted = Lic.XorEncrypt(Username, newkey);
  21. string Username_encrypted_hex = Lic.string_to_hex(Username_encrypted);
  22. Client.write(Username_encrypted_hex);
  23. string response_hex = Client.read();
  24. string response_encrypted = Lic.hex_to_string(response_hex);
  25. string response = Lic.XorEncrypt(response_encrypted, newkey);
  26. if (response == "1")
  27. {
  28. ui->label_loginstatus->setText("");
  29. DWORD dw = Lic.GetHWID();
  30. QString qstr = QString::number(dw);
  31. std::string utf8 = qstr.toUtf8().constData();
  32. string HWID_Encrypted = Lic.XorEncrypt(utf8, newkey);
  33. string HWID_Hex = Lic.string_to_hex(HWID_Encrypted);
  34. Client.write(HWID_Hex);
  35. string response2_hex = Client.read();
  36. string response2_encrypted = Lic.hex_to_string(response2_hex);
  37. string response2_decrypted = Lic.XorEncrypt(response2_encrypted, newkey);
  38. qDebug() << "HWID Input (Decrypted)" << QByteArray::fromStdString(response2_decrypted);
  39. if (response2_decrypted == "2")
  40. {
  41. Client.write(Lic.string_to_hex(Lic.XorEncrypt("sub", newkey)));
  42. string response3_hex = Client.read();
  43. string response3_encrypted = Lic.hex_to_string(response3_hex);
  44. string response3_decrypted = Lic.XorEncrypt(response3_encrypted, newkey);
  45. int response3_int = atoi(response3_decrypted.c_str());
  46. bool subexpired = false;
  47.  
  48. qDebug() << "Sub remaining (Decrypted)" << QByteArray::fromStdString(response3_decrypted);
  49.  
  50. if (response3_decrypted == XorString("Lifetime"))
  51. {
  52. Client.disconnect();
  53. Licensing::substatus = XorString("Your Subscription is Lifetime.");
  54. }
  55.  
  56. if (response3_decrypted == XorString("Banned"))
  57. {
  58. Client.disconnect();
  59. MessageBox(nullptr, TEXT(XorString("You are banned from LIGHTHACK!")), TEXT("Error"),MB_OK);
  60. QCoreApplication::quit();
  61. }
  62.  
  63. if (response3_decrypted == XorString("0") || response3_int < 0)
  64. {
  65. Client.disconnect();
  66. MessageBox(nullptr, TEXT(XorString("Your Subscription expired.")), TEXT("Error"),MB_OK);
  67. subexpired = true;
  68. }
  69.  
  70. if (response3_decrypted != XorString("0") && response3_decrypted != "" && response3_decrypted != XorString("Lifetime"))
  71. {
  72. Client.disconnect();
  73. Licensing::substatus = XorString("Your Subscription expires in ") + response3_decrypted + XorString(" Days.");
  74. }
  75.  
  76. if (response3_decrypted != XorString("0") && response3_decrypted != XorString("Banned") && response3_decrypted != "" && subexpired == false)
  77. {
  78. Client.disconnect();
  79. bool UpdateStatus = Lic.UpdateApp();
  80. if (UpdateStatus == false)
  81. {
  82. Downloader dl;
  83. dl.doDownload();
  84. this->hide();
  85. sw.setModal(true);
  86. sw.exec();
  87. }
  88. if (UpdateStatus == true)
  89. {
  90. this->hide();
  91. system("LIGHTHACK.exe");
  92. std::this_thread::sleep_for(std::chrono::milliseconds(500));
  93. this->close();
  94. }
  95. }
  96. }
  97. if (response2_decrypted == "3")
  98. {
  99. MessageBox(nullptr, TEXT(XorString("HWID is invalid.")), TEXT(XorString("Error")),MB_OK);
  100. QCoreApplication::quit();
  101. }
  102. }
  103. if (response == "0")
  104. {
  105. ui->label_loginstatus->setTextFormat(Qt::RichText);
  106. ui->label_loginstatus->setAlignment(Qt::AlignRight);
  107. ui->label_loginstatus->setStyleSheet("QLabel { color : red; }");
  108. ui->label_loginstatus->setMaximumSize(200, 200);
  109. ui->label_loginstatus->setText(QString::fromStdString(XorString("Password or Username is invalid.")));
  110. Client.disconnect();
  111. }
  112. }
  113. else if (status == false)
  114. {
  115. ui->label_loginstatus->setTextFormat(Qt::RichText);
  116. ui->label_loginstatus->setAlignment(Qt::AlignRight);
  117. ui->label_loginstatus->setStyleSheet("QLabel { color : red; }");
  118. ui->label_loginstatus->setMaximumSize(200,200);
  119. ui->label_loginstatus->setText(QString::fromStdString(XorString("Connection to the Server failed.")));
  120. Client.disconnect();
  121. }
  122. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement