home *** CD-ROM | disk | FTP | other *** search
/ Cracking 2 / Cracking II..iso / Texty / crackme / SHOWEQU.C < prev    next >
Encoding:
C/C++ Source or Header  |  1997-06-08  |  1.8 KB  |  56 lines

  1. #include <stdlib.h>
  2. #include <stdio.h>
  3. #include <conio.h>
  4.  
  5. #define EQUATIONS 1008
  6.  
  7. unsigned char buffer[200];
  8. FILE *plik, *out;
  9. int chars, passbits, i, j, cos;
  10.  
  11. main()
  12. {
  13.   cputs("\r\n╔══════════════════════════════════════════════════════════════════════════════╗");
  14.   cputs("║                           TEST4 by LordByte SOLVED                           ║");
  15.   cputs("║                 All the hard work was done in 1997 by CR00CK                 ║");
  16.   cputs("║     Firstly, run TESTCRK, and then SHOWEQU, entering same number in both     ║");
  17.   cputs("║    Then, check EQU.TXT - numbers on the left are bit numbers in password     ║");
  18.   cputs("║     On the right you have value, which you should get after XORING bits      ║");
  19.   cputs("║ If there is nothing on the left side (line is = 1), it means there are some  ║");
  20.   cputs("║     CONTRADICTORY equations, so password of this length cannot be found      ║");
  21.   cputs("║                                                                       CR00CK ║");
  22.   cputs("╚══════════════════════════════════════════════════════════════════════════════╝");
  23.   if ((plik = fopen("EQU.DAT", "rb")) == NULL)
  24.   {
  25.     printf("\nCannot find EQU.DAT!\n");
  26.     return 255;
  27.   }
  28.   do {
  29.     printf("How many chars (1 - 12): ");
  30.     scanf("%i", &chars);
  31.   } while (chars < 1 || chars > 12);
  32.   passbits = chars * 8;
  33.   if ((out = fopen("EQU.TXT", "w")) == NULL)
  34.   {
  35.     printf("\nCannot create EQU.TXT!\n");
  36.     return 255;
  37.   }
  38.  
  39.   for (i = 0; i < EQUATIONS; i++)
  40.   {
  41.     fread(buffer, passbits + 1, 1, plik);
  42.     cos = 0;
  43.     for (j = 0; j < passbits; j++)
  44.       if (buffer[j])
  45.       {
  46.         fprintf(out, "%i, ", j);
  47.         cos = 1;
  48.       }
  49.     if (cos || buffer[passbits])
  50.       fprintf(out, "= %i\n", buffer[passbits]);
  51.   }
  52.   fclose(plik);
  53.   fclose(out);
  54.  
  55.   return 0;
  56. }