Advertisement
Guest User

LuCiFeR's First C++ Crackme - Keygen

a guest
Jul 22nd, 2014
260
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.00 KB | None | 0 0
  1. /**
  2.     Logic for keygen ripped off from assembly
  3.     http://crackmes.de/users/lucifer/first_c_crackme/
  4. **/
  5. #ifdef _MSC_VER
  6.     #define _CRT_SECURE_NO_WARNINGS
  7. #endif
  8.  
  9. #include <stdio.h>
  10. #include <conio.h>
  11. #include <string.h>
  12. #include <stdlib.h>
  13.  
  14. void main()
  15. {
  16.     char test[20];
  17.     int res;
  18.  
  19.     printf("Enter Username: ");
  20.     scanf("%s", test);
  21.  
  22.     int len = strlen(test);
  23.  
  24.     __asm
  25.     {
  26.             pushad;                 //save contents of registry - so that we don't screw the flow
  27.             sub esp, 50;                //for our dirty work
  28.             mov edx, len;
  29.             imul edx, edx, 0x875CD;
  30.             mov eax, 0x51EB851F;
  31.             mul edx;
  32.             mov eax, edx;
  33.             shr eax, 5;
  34.             imul eax, eax, -0x370;
  35.             mov edx, 0;
  36.             push edx;
  37.             push eax;
  38.             fild QWORD PTR SS : [ESP];
  39.             lea esp, DWORD PTR SS : [ESP + 0x8];
  40.             fstp QWORD PTR SS : [ESP + 0x8];
  41.             mov eax, [ESP + 8];
  42.             mov res, eax;               //save the result required
  43.             add esp, 50;                //adjust stack
  44.             popad;                  //reload saved registry entries
  45.     }
  46.  
  47.     printf("%i-x019871", res);
  48.     _getch();
  49.     return;
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement