Jump to content
Tuts 4 You

Need help creating my first keygen for a CrackMe


Lukesc1993

Recommended Posts

So I just cracked my first CrackMe and found out how the program computes the registration number and now I wanna write a keygen for it.


 


What program should I use to write the keygen and could anyine get me started on the code?


 


The algorithm the CrackMe uses to create the correct keygen is:


 


Get hex value of each letter in username


Add each letter in hex together


Multiply the value by 539


Output as decimal


 


Thanks to anyone who can help :)


Link to comment

VB .NET 2010



Public Class frmKeygen
Private name As String = ""
Dim character As Long = 0
Private sum As Integer Private Sub txtInput_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtInput.TextChanged
name = txtInput.Text
Try
For i = 0 To name.Length - 1
character = character + Asc(name.Substring(i, 1))
Next
character = character * 539
txtOutput.Text = character.ToString
Catch ex As Exception
MessageBox.Show("The result of multiplication is too high.", "Try less characters for the name.", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
End Try End Sub
End Class

Project.7z

Keygen.7z

  • Like 1
Link to comment

C# .Net 3.5 - Console App - compile with SharpDevelop/VisualStudio/MonoDevelop/...



using System;
using System.IO;
using System.Linq;
using System.Reflection; namespace Keygen
{
class Program
{
static void Main( string[] args )
{
if( args.Length == 0 )
{
string thisExe = Path.GetFileName( Assembly.GetExecutingAssembly().GetName().Name );
Console.WriteLine( "Use {0}.exe USERNAME", thisExe );
return;
} // first prog argument
string username = args[ 0 ]; // call/invoke Generate-Method
decimal key = Generate( username ); // show result, Output as decimal
Console.WriteLine( "Key: '{0}'", key );
} // easy to understand Method
static decimal Generate( string username )
{
decimal result = 0; //Get hex value of each letter in username
foreach( char letter in username )
{
//Add each letter in hex together
result = result + (byte)letter;
} //Multiply the value by 539
result = result * 539; return result;
} // pro variant
static decimal ProGenerate( string username )
{
return username.Aggregate<char, decimal>( 0, ( current, letter ) => current + (byte)letter ) * 539;
}
}
}

Link to comment

Howdy.
Did Someone Forget other none .NET Languages?

 

Here is one for Delphi 7 (this is just the function that generates the key)

function MakeMyKey(UserName: string): string;var  intCounter, intHolder: Integer;  strFinalKey: string;begin  if (Length(UserName) < 1) then  begin    ShowMessage('Hey Cutie, Don' + 't be ' + 'shy :(' + sLineBreak +      'Please give me a Name');  end  else  begin    intHolder := 0;    for intCounter := 1 to (Length(UserName)) do    begin      intHolder := intHolder + Ord(UserName[intCounter]);    end;    strFinalKey := IntToStr(intHolder * 539);    Form1.edtSerial.Text := strFinalKey;  end;end;

Attached is the Keygen and its Full Source.

 

Lukesc1993 Keygen.zipLukesc1993 Src.zip

  • Like 1
Link to comment

Howdy.

Did Someone Forget other none .NET Languages?

 

Did you mean this?

#include <iostream>#include <string>using namespace std;int main(){    int suma, lungime;	string nume;	cout << "Simple translation to C++ by GIV\n";	cout << "Please enter your name: "<<endl;    cin >> nume;    lungime = nume.length();	suma = 0;for (unsigned int i = 0; i < nume.size(); i++){     suma += nume[i];}cout << "The final calculus is:"<<endl;		cout << suma*539 << endl;     system("pause");    return 0;}

C++.7z

  • Like 1
Link to comment

Did someone forget about the non-high-level languages? ;)



Generate proc hWnd:HWND invoke GetDlgItemText, hWnd, IDC_NAME, addr NameBuffer, 17 ; Cap name length to 17
mov edi,offset NameBuffer
invoke lstrlen,edi
mov esi,eax
xor ecx,ecx
xor eax,eax cmp esi, 01h ; Jump if no name entered
jl BADERROR xor eax, eax
xor edx, edx @@: mov dl, byte ptr [NameBuffer + ecx]
add eax, edx inc ecx
cmp ecx, esi
jnz @b mov ecx, 21Bh ; 21Bh = 539d
mul ecx invoke wsprintf, addr SerialBuffer, addr FormatControl, eax
invoke SetDlgItemText, hWnd, IDC_SERIAL, addr SerialBuffer BADERROR: xor eax, eax
ret Generate endp

Lukesc1993.zip


Edited by Office Jesus
  • Like 4
Link to comment

Why not AutoIT? lol



#include <MsgBoxConstants.au3> Example()
Func Example()
Local $i, $output
Local $Input = InputBox("Input","", "", "") For $i=0 to StringLen($input)
$output = $output + Asc(StringMid($input,$i,1))
Next $output = $output * 539 MsgBox($MB_SYSTEMMODAL, "", $output) EndFunc ;==>Example

  • Like 1
Link to comment

I am to late.


No new code from my side


only a bit shorter ASM code of Office Jesus



Generate proc hWnd:HWND invoke GetDlgItemText, hWnd, IDC_NAME, addr NameBuffer, 17 ; Cap name length to 17
.if eax
lea edi, NameBuffer
xor eax,eax
and edx,0
.repeat
mov dl,byte ptr [edi]
add eax, edx
inc edi
.until byte ptr[edi] == 0
imul eax,eax,21Bh
invoke wsprintf, addr SerialBuffer, addr FormatControl, eax
invoke SetDlgItemText, hWnd, IDC_KEY, addr SerialBuffer
.endif ret Generate endp


of course it can be done shorter.


(btw. i was to lazy, so i used OfficeJesus own code snippet.)


 


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...