Advertisement
Guest User

Untitled

a guest
Jan 21st, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.78 KB | None | 0 0
  1. #include <iostream>
  2. #include <Windows.h>
  3.  
  4. #pragma warning(disable:4996)
  5.  
  6. void ProtectedExit()
  7. {
  8.     MessageBoxA(NULL, "Protected Exit Was Called!", NULL, NULL);
  9.     if (*(BYTE*)&exit == 0xC3)
  10.     {
  11.         ExitProcess(0);
  12.         ExitThread(0);
  13.     }
  14.     else
  15.     {
  16.         ExitProcess(0);
  17.         exit(0);
  18.     }
  19. }
  20. BOOL getAuthKey(DWORD* Varib)
  21. {
  22.     DWORD n = 0;
  23.     if (GetVolumeInformationA(NULL, NULL, NULL, &n, NULL, NULL, NULL, NULL))
  24.     {
  25.         *Varib = n;
  26.         return false;
  27.     }
  28.     else
  29.     {
  30.         MessageBoxA(NULL, "Protected Exit Was Called! IN GetAuth", NULL, NULL);
  31.         ProtectedExit();
  32.         return true;
  33.     }
  34.        
  35. }
  36.  
  37.  
  38.  
  39. void Protect(void* Function, BYTE orgOP)
  40. {
  41.     /* First Check */
  42.     DWORD old;
  43.     VirtualProtect((void*)Function, 1, PAGE_READONLY, &old);
  44.     if (old != PAGE_READONLY)
  45.     {
  46.         MessageBoxA(NULL, "Error At PagePro", NULL, NULL);
  47.         ProtectedExit();
  48.     }
  49.     else
  50.         return;
  51.  
  52.     /* Second Check*/
  53.     if (*(BYTE*)Function != orgOP)
  54.     {
  55.         MessageBoxA(NULL, "Error At Cop check", NULL, NULL);
  56.         ProtectedExit();
  57.     }
  58.     else
  59.         return;
  60. }
  61. int main()
  62. {
  63.     WriteProcessMemory(GetCurrentProcess(), (void*)&FreeConsole, "\xC3", 1, nullptr);
  64.     AllocConsole();
  65.     freopen("CONIN$", "r", stdin);
  66.     freopen("CONOUT$", "w", stdout);
  67.  
  68.     std::cout << "If you get a message saying \"U beat it\" Then You Cracked This! Else You Get \"FAIL!\"\n";
  69.     DWORD Auth = 0;
  70.     DWORD old;
  71.     bool Start_End = false;
  72.     bool status = getAuthKey(&Auth);
  73.     BYTE cAuth(*(BYTE*)&Auth), cStartEnd(*(BYTE*)&Start_End), cStatus(*(BYTE*)&status);
  74.     if (status == true)
  75.     {
  76.         MessageBoxA(NULL, "Error At Cop check", NULL, NULL);
  77.         ProtectedExit();
  78.     }
  79.     for(int x = 0; x < 10; x++)
  80.     {
  81.         Protect(&Auth, cAuth);
  82.         Protect(&Start_End, cStartEnd);
  83.         Protect(&status, cStatus);
  84.         std::cout << "Works\n";
  85.     }
  86.    
  87.     /* Getting Authentication is ok*/
  88.     /* Connection */
  89.  
  90.  
  91.     return 0;
  92. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement