Your goal is to crack the file and make a tutorial and/ or write instructions about the steps done by you.
What is C++/CLI?
C++/CLI is C++ support .NET framework to make managed application run on .NET framework.
https://en.wikipedia.org/wiki/C%2B%2B/CLI
Feel free to post your solutions.
#pragma once
#include <cstdlib>
#include <string>
#include <Windows.h>
namespace CppCLR_WinformsProjekt {
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
/// <summary>
/// Zusammenfassung für Form1
/// </summary>
public ref class Form1 : public System::Windows::Forms::Form
{
public:
Form1(void)
{
InitializeComponent();
//
//TODO: Konstruktorcode hier hinzufügen.
//
}
protected:
/// <summary>
/// Verwendete Ressourcen bereinigen.
/// </summary>
~Form1()
{
if (components)
{
delete components;
}
}
protected:
private: System::Windows::Forms::Label^ label1;
private: System::Windows::Forms::Label^ label3;
private: System::Windows::Forms::RichTextBox^ richTextBox1;
private:
/// <summary>
/// Erforderliche Designervariable.
/// </summary>
System::ComponentModel::Container ^components;
#pragma region Windows Form Designer generated code
/// <summary>
/// Erforderliche Methode für die Designerunterstützung.
/// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden.
/// </summary>
void InitializeComponent(void)
{
this->label1 = (gcnew System::Windows::Forms::Label());
this->label3 = (gcnew System::Windows::Forms::Label());
this->richTextBox1 = (gcnew System::Windows::Forms::RichTextBox());
this->SuspendLayout();
//
// label1
//
this->label1->AutoSize = true;
this->label1->Location = System::Drawing::Point(211, 286);
this->label1->Name = L"label1";
this->label1->Size = System::Drawing::Size(46, 17);
this->label1->TabIndex = 1;
this->label1->Text = L"label1";
//
// label3
//
this->label3->AutoSize = true;
this->label3->Location = System::Drawing::Point(41, 169);
this->label3->Name = L"label3";
this->label3->Size = System::Drawing::Size(95, 17);
this->label3->TabIndex = 3;
this->label3->Text = L"License key : ";
//
// richTextBox1
//
this->richTextBox1->Location = System::Drawing::Point(142, 95);
this->richTextBox1->Name = L"richTextBox1";
this->richTextBox1->Size = System::Drawing::Size(515, 159);
this->richTextBox1->TabIndex = 5;
this->richTextBox1->Text = L"";
this->richTextBox1->TextChanged += gcnew System::EventHandler(this, &Form1::richTextBox1_TextChanged);
//
// Form1
//
this->AutoScaleDimensions = System::Drawing::SizeF(8, 16);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System::Drawing::Size(716, 410);
this->Controls->Add(this->richTextBox1);
this->Controls->Add(this->label3);
this->Controls->Add(this->label1);
this->FormBorderStyle = System::Windows::Forms::FormBorderStyle::FixedDialog;
this->Margin = System::Windows::Forms::Padding(4);
this->Name = L"Form1";
this->Text = L"Form1";
this->Load += gcnew System::EventHandler(this, &Form1::Form1_Load);
this->ResumeLayout(false);
this->PerformLayout();
}
#pragma endregion
private: System::Void textBox1_TextChanged(System::Object^ sender, System::EventArgs^ e) {
}
private: System::Void textBox2_TextChanged(System::Object^ sender, System::EventArgs^ e) {
System::Security::Cryptography::SHA256 ^sha256 = System::Security::Cryptography::SHA256::Create();
///String ^s = String::Format("teer4y00t@GMAIL.COM");
/* String ^s = String::Format("som@GMAIL.COM");
array<wchar_t> ^ss = s->ToCharArray();
pin_ptr<wchar_t> p = &ss[0];
char cs[1000] = { 0 };
wcstombs(cs, p, 1000);
array<unsigned char> ^buffer = gcnew array<unsigned char>(s->Length);
for (int i = 0; i < s->Length; i++) {
buffer[i] = cs[i];
}
array<unsigned char>^ hash = sha256->ComputeHash(buffer);
char result[256] = { 0 };
for (int i = 0; i < hash->Length; i++) {
char o[32];
pin_ptr<unsigned char> p = &hash[0];
sprintf(o, "%02X", p[i]);
strcat(result, o);
//result[i] = hash[i];
}
String ^output = gcnew String(result);
MessageBox::Show(output);*/
}
private: System::Void richTextBox1_TextChanged(System::Object^ sender, System::EventArgs^ e) {
System::Security::Cryptography::SHA256 ^sha256 = System::Security::Cryptography::SHA256::Create();
char comp_buf[256];
DWORD size = 256;
GetComputerNameA(comp_buf,&size);
String ^s = String::Format("teer4y00t@GMAIL.COM");
//String ^s = String::Format("som@GMAIL.COM");
s = gcnew String(comp_buf);
s += "abcdef";
array<wchar_t> ^ss = s->ToCharArray();
pin_ptr<wchar_t> p = &ss[0];
char cs[1000] = { 0 };
wcstombs(cs, p, 1000);
array<unsigned char> ^buffer = gcnew array<unsigned char>(s->Length);
for (int i = 0; i < s->Length; i++) {
buffer[i] = cs[i];
}
array<unsigned char>^ hash = sha256->ComputeHash(buffer);
char result[256] = { 0 };
//compare result
String ^enterLicense = richTextBox1->Text;
char b[33] = { 0 };
char css[1000] = { 0 };
{
array<wchar_t> ^ss = enterLicense->ToCharArray();
pin_ptr<wchar_t> p = &ss[0];
wcstombs(css, p, 1000);
for (int i = 0; i < 16; i++)
;// sprintf(b + i * 2, "%02x", cs[i]);
}
bool valid = true;
/* for (int i = 0; i < 33; i++) {
if (hash[i] != b[i])
{
valid = false;
break;
}
}
*/
for (int i = 0; i < hash->Length; i++) {
char o[32];
pin_ptr<unsigned char> p = &hash[0];
sprintf(o, "%02X", p[i]);
strcat(result, o);
//result[i] = hash[i];
}
//check lic
//valid = true;
for (int i = 0; i < hash->Length*2; i++) {
unsigned char item1 = css[i];
unsigned char item2 = result[i];
if (css[i] != result[i]) {
valid = false;
break;
}
else {
}
/*if (css[i] == result[i]) {
}
else {
valid = false;
label1->Text = "Invalid";
break;
}*/
}
if (valid)
label1->Text = "Thank license key is valid.";
else
label1->Text = "License key is invalid";
String ^output = gcnew String(result);
//MessageBox::Show(output);
}
private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) {
}
};
}
Recommended Comments