Advertisement
asqapro

Bypass AVA Xigncode

Sep 4th, 2014
804
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.32 KB | None | 0 0
  1. #define WINVER 0x0500
  2. #include <iostream>
  3. #include <windows.h>
  4.  
  5. using namespace std;
  6.  
  7. BOOL EnableDebugPrivilege(BOOL bEnable) //gives you debug priv, usually not needed, but it fixed a problem for me
  8. {
  9.     HANDLE hToken = NULL;
  10.     LUID luid;
  11.  
  12.     if (!OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES, &hToken)) return FALSE;
  13.     if (!LookupPrivilegeValue(NULL, SE_DEBUG_NAME, &luid)) return FALSE;
  14.  
  15.     TOKEN_PRIVILEGES tokenPriv;
  16.     tokenPriv.PrivilegeCount = 1;
  17.     tokenPriv.Privileges[0].Luid = luid;
  18.     tokenPriv.Privileges[0].Attributes = bEnable ? SE_PRIVILEGE_ENABLED : 0;
  19.  
  20.     if (!AdjustTokenPrivileges(hToken, FALSE, &tokenPriv, sizeof(TOKEN_PRIVILEGES), NULL, NULL)) return FALSE;
  21.  
  22.     return TRUE;
  23. }
  24.  
  25. int main()
  26. {
  27.     HWND ava_wind;
  28.     string windowName = "Alliance of Valiant Arms";
  29.     cout << "Waiting for AVA..." << endl;
  30.     while(true){
  31.         ava_wind = FindWindow(NULL, windowName.c_str());
  32.         if(ava_wind != 0){
  33.             break;
  34.         }
  35.         Sleep(1);
  36.     }
  37.     /*TCHAR title[500];
  38.     while(true){
  39.         ava_wind = GetForegroundWindow();
  40.         if(GetWindowText(ava_wind, title, 500)+1 == 25){ //this checks the length of the window name
  41.             break;
  42.         }
  43.         Sleep(1);
  44.     }*/
  45.     EnableDebugPrivilege(true);
  46.     DWORD* process_ID = new DWORD;
  47.     GetWindowThreadProcessId(ava_wind, process_ID);
  48.     HANDLE hProcess = OpenProcess(PROCESS_VM_OPERATION|PROCESS_VM_WRITE|PROCESS_VM_READ, FALSE, *process_ID);
  49.     if(!hProcess){
  50.         cout << GetLastError() << endl;
  51.         cout << "Could not open the process!" << endl;
  52.     }
  53.     else{
  54.         if(VirtualAllocEx(hProcess, NULL, 1, MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE) != NULL){}
  55.         else{
  56.             cout << "VirtualAllocEx Failed" << endl;
  57.             cout << GetLastError() << endl; //get what error it returned
  58.         }
  59.         int newdata = 0xC3; //RETN in asm
  60.         DWORD newdatasize = sizeof(newdata);
  61.         if(WriteProcessMemory(hProcess, (LPVOID)0x041000, &newdata, newdatasize, NULL)){ //old address
  62.             cout << "XIGNCode Bypassed" << endl;
  63.         }
  64.         else{
  65.             cout << GetLastError() << endl;
  66.             cout << "Error cannot WriteProcessMemory!" << endl;
  67.         }
  68.         CloseHandle(hProcess);
  69.     }
  70.     Sleep(10000);
  71.     return 0;
  72. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement