This are my solution for “crackmes.one – crackme by rayko” Reversing Challenge.
Challenge source: https://crackmes.one/crackme/5ab77f6633c5d40ad448cc4b
Difficult: Easy
In this Challenge the solution are create a KeyGen.
1-) Open the executable with any dissembler. For my own, I use the JetBrains dotPeek.
2-) Find the “Form1”.
3-) Find the “btnCheck_Click” method.
4-) Read the Code.
private void btnCheck_Click(object sender, EventArgs e)
{
if (Operators.CompareString(Strings.Trim(this.txtSerial.Text), Conversions.ToString(this.Encrypt(Strings.Trim(this.txtName.Text))), false) == 0)
{
int num1 = (int)Interaction.MsgBox((object)"You Put In The Right Serial Number", MsgBoxStyle.OkOnly, (object)null);
}
else
{
int num2 = (int)Interaction.MsgBox((object)"Try Again", MsgBoxStyle.OkOnly, (object)null);
}
}
As you can see, there’s a comparison between the SerialNumber and the result of “Encrypt” function passing the “Name” value into.
The Encrypt function can be found bellow this code:
private int Encrypt(string Input)
{
int num1 = checked(Input.Length - 1);
int startIndex = 0;
int num2;
while (startIndex <= num1)
{
char String = Conversions.ToChar(Input.Substring(startIndex));
num2 = checked((int)Math.Round(unchecked(Conversions.ToDouble(Conversion.Oct(Strings.Asc(Conversions.ToString(num2))) + Conversion.Oct(Strings.Asc(String))) + 666.0)));
checked { ++startIndex; }
}
return num2;
}
Now, all we need to do is to create a new C# Console Application Project using Visual Studio (In my case, Visual Studio 2019 Community)
5-) Create a new C# Console Application using Visual Studio.
6-) Add “Microsoft.VisualBasic” dependency into your project.
7-) Add the “Encrypt” method and some code to printout the result.
using System;
using Microsoft.VisualBasic;
using Microsoft.VisualBasic.CompilerServices;
namespace ConsoleApp4
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine(
Encrypt("ANY VALUE")
);
Console.ReadLine();
}
static private int Encrypt(string Input)
{
int num1 = checked(Input.Length - 1);
int startIndex = 0;
int num2 = 0;
while (startIndex <= num1)
{
char String = Conversions.ToChar(Input.Substring(startIndex));
num2 = checked((int)Math.Round(unchecked(Conversions.ToDouble(Conversion.Oct(Strings.Asc(Conversions.ToString(num2))) + Conversion.Oct(Strings.Asc(String))) + 666.0)));
checked { ++startIndex; }
}
return num2;
}
}
}
😎 Run the Program, get the result and put they into “Serial” field and fill the “Name” field with the value that you put into the C# code (In this case: ANY VALUE).
And Done 😉