Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void MainWindow::on_pushButton_clicked()
- {
- secondwindow sw;
- string Username = ui->lineEdit_username->text().toStdString().c_str();
- string Password = ui->lineEdit_password->text().toStdString().c_str();
- Username += ":" + Password;
- bool status = Client.connect();
- if (status == true)
- {
- char beginningkey[6] = { DELETED SO MY CLIENT DOESNT GET CRACKED};
- char newkey[9];
- string encrypted = Lic.XorEncrypt("start", beginningkey);
- string encrypted_hex = Lic.string_to_hex(encrypted);
- Client.write(encrypted_hex);
- string str_newkey_hex = Client.read();
- string str_newkey_encrypted = Lic.hex_to_string(str_newkey_hex);
- string str_newkey_decrypted = Lic.XorEncrypt(str_newkey_encrypted, beginningkey);
- cout << str_newkey_decrypted << endl;
- std::memcpy(newkey, str_newkey_decrypted.c_str(), str_newkey_decrypted.size() + 1);
- string Username_encrypted = Lic.XorEncrypt(Username, newkey);
- string Username_encrypted_hex = Lic.string_to_hex(Username_encrypted);
- Client.write(Username_encrypted_hex);
- string response_hex = Client.read();
- string response_encrypted = Lic.hex_to_string(response_hex);
- string response = Lic.XorEncrypt(response_encrypted, newkey);
- if (response == "1")
- {
- ui->label_loginstatus->setText("");
- DWORD dw = Lic.GetHWID();
- QString qstr = QString::number(dw);
- std::string utf8 = qstr.toUtf8().constData();
- string HWID_Encrypted = Lic.XorEncrypt(utf8, newkey);
- string HWID_Hex = Lic.string_to_hex(HWID_Encrypted);
- Client.write(HWID_Hex);
- string response2_hex = Client.read();
- string response2_encrypted = Lic.hex_to_string(response2_hex);
- string response2_decrypted = Lic.XorEncrypt(response2_encrypted, newkey);
- qDebug() << "HWID Input (Decrypted)" << QByteArray::fromStdString(response2_decrypted);
- if (response2_decrypted == "2")
- {
- Client.write(Lic.string_to_hex(Lic.XorEncrypt("sub", newkey)));
- string response3_hex = Client.read();
- string response3_encrypted = Lic.hex_to_string(response3_hex);
- string response3_decrypted = Lic.XorEncrypt(response3_encrypted, newkey);
- int response3_int = atoi(response3_decrypted.c_str());
- bool subexpired = false;
- qDebug() << "Sub remaining (Decrypted)" << QByteArray::fromStdString(response3_decrypted);
- if (response3_decrypted == XorString("Lifetime"))
- {
- Client.disconnect();
- Licensing::substatus = XorString("Your Subscription is Lifetime.");
- }
- if (response3_decrypted == XorString("Banned"))
- {
- Client.disconnect();
- MessageBox(nullptr, TEXT(XorString("You are banned from LIGHTHACK!")), TEXT("Error"),MB_OK);
- QCoreApplication::quit();
- }
- if (response3_decrypted == XorString("0") || response3_int < 0)
- {
- Client.disconnect();
- MessageBox(nullptr, TEXT(XorString("Your Subscription expired.")), TEXT("Error"),MB_OK);
- subexpired = true;
- }
- if (response3_decrypted != XorString("0") && response3_decrypted != "" && response3_decrypted != XorString("Lifetime"))
- {
- Client.disconnect();
- Licensing::substatus = XorString("Your Subscription expires in ") + response3_decrypted + XorString(" Days.");
- }
- if (response3_decrypted != XorString("0") && response3_decrypted != XorString("Banned") && response3_decrypted != "" && subexpired == false)
- {
- Client.disconnect();
- bool UpdateStatus = Lic.UpdateApp();
- if (UpdateStatus == false)
- {
- Downloader dl;
- dl.doDownload();
- this->hide();
- sw.setModal(true);
- sw.exec();
- }
- if (UpdateStatus == true)
- {
- this->hide();
- system("LIGHTHACK.exe");
- std::this_thread::sleep_for(std::chrono::milliseconds(500));
- this->close();
- }
- }
- }
- if (response2_decrypted == "3")
- {
- MessageBox(nullptr, TEXT(XorString("HWID is invalid.")), TEXT(XorString("Error")),MB_OK);
- QCoreApplication::quit();
- }
- }
- if (response == "0")
- {
- ui->label_loginstatus->setTextFormat(Qt::RichText);
- ui->label_loginstatus->setAlignment(Qt::AlignRight);
- ui->label_loginstatus->setStyleSheet("QLabel { color : red; }");
- ui->label_loginstatus->setMaximumSize(200, 200);
- ui->label_loginstatus->setText(QString::fromStdString(XorString("Password or Username is invalid.")));
- Client.disconnect();
- }
- }
- else if (status == false)
- {
- ui->label_loginstatus->setTextFormat(Qt::RichText);
- ui->label_loginstatus->setAlignment(Qt::AlignRight);
- ui->label_loginstatus->setStyleSheet("QLabel { color : red; }");
- ui->label_loginstatus->setMaximumSize(200,200);
- ui->label_loginstatus->setText(QString::fromStdString(XorString("Connection to the Server failed.")));
- Client.disconnect();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement