Jump to content
Tuts 4 You

[KeyGenMe] .NET Keygen Me


master131
Go to solution Solved by kao,

Recommended Posts

7MIgYJE.png


 


This is my first keygen-me so good luck.


 


Original Language: C#


Difficulty: Beginner to Intermediate


Obfuscated: Yes (SmartAssembly)


Self-Keygen/IL-Patching: No


 


Not sure if the algo I wrote is used in real software but it works and creating a keygen for it shouldn't be too difficult.


Keygen Me.rar

Edited by master131
Link to comment
CodeExplorer

So we have 5 groups separated by "-"
each group is a hex number! class0_0.int_0 is a int array:
 int[] numArray = new int[] { 5, 2, 4, 6, 7 };   string[] strArray;
    if (string.IsNullOrEmpty(string_0))
    {
        return false;
    }
    if ((strArray = string_0.Split(new char[] { '-' })).Length != class0_0.int_0.Length)
    {
        return false;
    }
    List<int> list = new List<int>();
    foreach (string str in strArray)
    {
        int num;
        if (str.Length != 4)
        {
            return false;
        }
        if (!int.TryParse(str, NumberStyles.HexNumber, null, out num))
        {
            return false;
        }
        list.Add(num);
    }in the end we have a list with numbers!
The most important part:
for (int i = 0; i < list.Count; i++)
    {
        int num3 = 0;
        foreach (char ch in Convert.ToString(list, 2))  // convert int to base 2
        {
            num3 += (ch == '1') ? 1 : 0;
            // here char can be only 1 or 0 since is base 2
            // when char is 1 add 1 to the number
        }
        if (num3 != class0_0.int_0)
        {
            return false;
        }
    }
    return true;So  int[] numArray = new int[] { 5, 2, 4, 6, 7 };
means numbers of "1" in binary!Still don't know how to generate serials yet!

Link to comment

@CodeCracker I think this keygenme it's imposible to solve because each group must be 4 like this:


 


xxxx-xxxx-xxxx-xxxx-xxxx


 


If we replace the x with 1 with be 4 +1:


 


1111-1111-1111-1111-1111


 


num3 then the maximum value can be 4. The array contains 5, 2, 4, 6, 7. So the only possible serials that can be generated will be the 2nd and 3rd group on the serial. If we put another number that converted to base 2 will be also 1 or 0 so it's imposible to generate a serial.


Link to comment
CodeExplorer

LordCoder: you are actually wrong!


First of all each number is on Hexadecimal!


5 means 5 binary with "1": 11111 -> 1F -> 001F (since is 4 chars long)


2 means 2 binary with "1": 11 -> 3 -> 0003


4 means 4 binary with "1": 15 -> F -> 000F


6 means 6 binary with "1": 63 -> 3F -> 003F


7 means 7 binary with 1 -> 007F


Valid serial: 001F-0003-000F-003F-007F


and product registered!


I still don't know how to make a program which generates multiple serials :-D


I just do them manually!


Edited by CodeCracker
  • Like 2
Link to comment

maybe create empty space of 0 then fill it with 1 until 5,2,4,6,7  then convert it to hex like this 1001001101-100000001-100010101-1001100100101-11001101101 => 024d-0101-0115-1325-066d :D


Edited by ewwink
Link to comment

Great job guys. Creating a keygen is possible, but it might involve some bruteforcing.


 


Hint: 0x0000-0xFFFF ;)


Edited by master131
Link to comment

Umm, no. No bruteforce required, just some brain. ;)

PoC Keygen + relevant source attached.

 

Or you could do that, lol. Nice job. :prop:

Link to comment

It looked an easy target :P Yeah I was confused at it. Now I see it's better to do a protection with maths than with some other encryptions :D


  • Like 1
Link to comment

My sources:


Public Class frmKeygen
    Function ConvertBinToHex(ByVal a As String) As String
If a = "" Then
Return String.Empty
Else
Return Convert.ToString(Convert.ToInt32(a, 2), 16).ToUpper
End If
End Function Private Sub cmdGenereaza_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdGenereaza.Click Dim rnd As New Random()
Dim lungime As Integer = 4 Dim strdup As String = "11011"
Dim strreplicat As String = "0100"
Dim index As String = rnd.Next(0, strdup.Length)
Dim strfinal As String = strdup.Insert(index, strreplicat) txtSerial1.Text = "000" + ConvertBinToHex(strfinal)
txtSerial1.Text = Strings.Right(txtSerial1.Text, lungime) Dim strdup1 As String = "010"
Dim index1 As String = rnd.Next(0, strdup1.Length)
Dim strfinal1 As String = strdup1.Insert(index1, strreplicat)
txtSerial2.Text = "000" + ConvertBinToHex(strfinal1)
txtSerial2.Text = Strings.Right(txtSerial2.Text, lungime) Dim strdup2 As String = "10101"
Dim index2 As String = rnd.Next(0, strdup2.Length)
Dim strfinal2 As String = strdup2.Insert(index2, strreplicat)
txtSerial3.Text = "000" + ConvertBinToHex(strfinal2)
txtSerial3.Text = Strings.Right(txtSerial3.Text, lungime) Dim strdup3 As String = "101100101"
Dim index3 As String = rnd.Next(0, strdup3.Length)
Dim strfinal3 As String = strdup3.Insert(index3, strreplicat)
txtSerial4.Text = "000" + ConvertBinToHex(strfinal3)
txtSerial4.Text = Strings.Right(txtSerial4.Text, lungime) Dim strdup4 As String = "111010110"
Dim index4 As String = rnd.Next(0, strdup4.Length)
Dim strfinal4 As String = strdup4.Insert(index4, strreplicat)
txtSerial5.Text = "000" + ConvertBinToHex(strfinal4)
txtSerial5.Text = Strings.Right(txtSerial5.Text, lungime) Dim serialfinal As String = txtSerial1.Text & "-" & txtSerial2.Text & "-" & txtSerial3.Text & "-" & txtSerial4.Text & "-" & txtSerial5.Text
serialfinal = serialfinal.ToUpper
Clipboard.SetText(serialfinal)
End Sub
End Class
 

And attached is a little aesthetic change to the keygen.


Keygen for master131 KeyGenMe.rar

Edited by GIV
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...