SecurityXploded.com
Creating KEYGEN for Crackme Code | www.SecurityXploded.com
 
 
Creating Keygen for Crackme Code
Author: Harsimran Walia 
 
 
 
See Also
 
 
 
Contents
 
 
Introduction

In this article, we will learn how to create Keygen for sample crackme presented in our Reversing Session.

This article is the part of our free "Reverse Engineering & Malware Analysis Course".

You can visit our training page here and all the presentations of previous sessions here

 
 

In our last Training session "Part 4 - Practical Reversing (I)" we have seen how to reverse sample crackme by both static & dynamic reversing.


In this article, we will create the Keygen for the same crackme code.

 
 
Crackme Algorithm
The crackme takes two inputs Username and Password, then generates new password based on the username.

Here is the Password generation algorithm.

 
len = Username_length
For i = len-1 to 0 and j = 0 len-1
NewPass[j] = Username[i] + i
 
Next it compares the input password with generated password to verify if user has entered Valid password.
 
 
Generating KeyGen Code
 
Now the keygen should be able to generate the new Password based on the userName input from the user which should crack the crackme.

The code for Keygen is as listed below contains the algorithm that is used by the crackme and outputs the username/password couple to successfully defeat this Crackme.

 
#include 
#include 
#include 

int main()
{
    char a[10],c[10],d;
    int i,j,k=0;
    printf("#Keygen by b44nz0r\n\n");
    
    while (k <5 || k >=10)
    {
          if (k !=0)
             printf("\nThe username length should be 5 to 10 alphabets\n");
        
         printf("enter username: ");
         scanf("%s",a);
         k = strlen(a);
    }
    
    i = k-1;
    j = 0;
    
    while (i >= 0)
    {
          c[j] = a[i]+i;
          i--;
          j++;
    }
    
    c[j] = 0;
    printf("\nThe password is %s\n",c);
    printf("\nHit Enter to Exit\n");
    getchar();
    getchar();
} 
 
 
 
Disclaimer
 
This article is provided STRICTLY for educational purposes only. This keygen is for Sample code written to teach the basic reversing.

It is part of our ongoing FREE Reversing & Malware Analysis Course.


 
 
References
  1. Reversing & Malware Analysis Training
  2. Reference Guide - Reversing/Malware Analysis Training
  3. Training Session Part 4 - Practive Reversing (I)
 
 
See Also