home *** CD-ROM | disk | FTP | other *** search
/ Cracking 2 / Cracking II..iso / Texty / crackme / LEVEL1.C < prev    next >
Encoding:
C/C++ Source or Header  |  1999-07-23  |  3.0 KB  |  93 lines

  1. //******************************************************************
  2. //*          solution for CrackMe Level 1 By noos@nettaxi.com      *
  3. //*                   solved By Nuno1 on 22 july 1999              *
  4. //*           any comments can be sent to nuno_2@hotmail.com       *
  5. //******************************************************************
  6.  
  7. //This file will search for all combinations until reach the
  8. //The Result.
  9.  
  10. //the Key is 692659380
  11.  
  12. #include <stdio.h>
  13. #include <string.h>
  14. #include <stdlib.h>
  15. #include <time.h>
  16. //CharTables for the Key.
  17. const char CHARTABLE[26] ={'A','B','C','D','E','F','G','H','I','J','K','L',
  18.                            'M','N','O','P','Q','R','S','T','U','V','W','X',
  19.                            'Y','Z'};
  20.  
  21. //**********************************************//
  22. //        Print a logo for the program
  23. //**********************************************//
  24.  
  25. void PrintLogo() {
  26.     printf("************************************************\n");
  27.     printf("solution for CrackMe Level 1 By noos@nettaxi.com\n");
  28.     printf("         solved By Nuno1 on 22 july 1999        \n");
  29.     printf(" any comments can be sent to nuno_2@hotmail.com \n");
  30.     printf("************************************************\n");
  31. }
  32. //*********************************************//
  33. //                   Main Program                 //
  34. //*********************************************//
  35.  
  36. void main() {
  37.     unsigned long Count=0;         //This will the Key when finished.
  38.     unsigned long MyNumber=0;
  39.     unsigned long TempNumber=0;
  40.  
  41.     char *RESULT ="TSSFTMEZDPKS";  //The result we need to get to.
  42.     char *Code;                    //our build Key.
  43.     int t;
  44.     time_t ti;                     //solving how much time it took.
  45.     time_t t1;
  46.     int Min , Sec;
  47.     //Print the logo
  48.     PrintLogo();
  49.     //get the current timer to resolve the total time it took.
  50.     ti = time(NULL);
  51.     printf("Please wait while computing the key .......");
  52.     Code = (char *)malloc(13);     //Get space for the code , the code
  53.                                    //must be 13 characters.
  54.     Code[12] = 0;
  55.     //srand is just take the number you gave him and keep it.
  56.     while(1) {   //unfinished loop
  57.         MyNumber = Count;       //start the calculation
  58.         for(t=0;t<=11;t++) {
  59.             //This is rand function
  60.             MyNumber = MyNumber * 0x343fd;
  61.             MyNumber += 0x269ec3;
  62.             TempNumber = MyNumber;
  63.             TempNumber = TempNumber >> 0x10;
  64.             TempNumber = TempNumber & 0x000007FFF;
  65.  
  66.             TempNumber = TempNumber % 0x1a;
  67.             Code[t] =CHARTABLE[TempNumber];
  68.             //Compare each character with the result.
  69.             //if its not we break (t will not be 12).
  70.             if (Code[t] != RESULT[t]) break;
  71.         }
  72.         //when t ==12 the code as been build.
  73.         if(t == 12) {
  74.             printf("\n%s   = %ld \n",Code,Count);
  75.             //take the current time
  76.             t1 = time(NULL);
  77.             t1 = t1 - ti;   //sub it with the firs time.
  78.             //we assume it will not take more then a hour.
  79.             Min  = t1 / 60;  // take the minutes.
  80.             Sec  = t1 % 60;  // take the seconds.
  81.  
  82.             printf("The search took %d minutes and %d seconds.\n",Min,Sec);
  83.             //exit.
  84.             exit(1);
  85.         }
  86.         //each time increate the counter by one.
  87.         Count ++;
  88.  
  89.     }
  90. }
  91.  
  92. //end of program.
  93.