Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2018
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.53 KB | None | 0 0
  1. typedef DWORD_PTR(__stdcall *_qDeCrypt)(DWORD_PTR esi);
  2. PVOID codeMem = NULL;
  3.  
  4. template<typename T> T rol(T val, size_t count)
  5. {
  6. size_t bitcount = sizeof(T) * 8;
  7. count %= bitcount;
  8. return (val << count) | (val >> (bitcount - count));
  9.  
  10. }
  11. DWORD_PTR DecryptData(DWORD_PTR cryptedOffset, DWORD_PTR decryptFuncBase)
  12. {
  13. if (codeMem == NULL)
  14. codeMem = VirtualAlloc(0, 1024, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
  15.  
  16. DWORD_PTR _esi = mem->RPM<DWORD_PTR>(cryptedOffset + 8, 8);
  17. DWORD_PTR raxrbx = mem->RPM<DWORD_PTR>(cryptedOffset, 8);
  18.  
  19. DWORD key1 = (DWORD(raxrbx) >> 8); //shr edx,08
  20. BYTE key2 = BYTE(raxrbx) ^ BYTE(key1); //xor dl,dil
  21. DWORD key3 = rol<BYTE>(key2, BYTE(raxrbx)); //rol dl,cl
  22. DWORD index = key3 & 0x1F; //and edx,1F
  23.  
  24.  
  25. DWORD_PTR targetFunc = mem->RPM<DWORD_PTR>(decryptFuncBase + (index * 8), 8);
  26. if(!ReadProcessMemory(mem->GetHandle(), (LPVOID)targetFunc, codeMem, 60, NULL))
  27. {
  28. return 0;
  29. }
  30.  
  31. if (*(WORD*)(codeMem) != 0xC148) //ror ecx,xx
  32. return 0;
  33.  
  34. _qDeCrypt qDecrypt3 = (_qDeCrypt)codeMem;
  35. auto ret = qDecrypt3(_esi);
  36. ZeroMemory(codeMem, 60);
  37. return ret;
  38. }
  39.  
  40. auto PersistentLevel = mem->RPM<DWORD_PTR>(global::pUWorld + 0x30, 0x8);
  41. uint64_t DecryptedActorArrayPointer = DecryptData(PersistentLevel + 0xA0, mem->GetBase() + 0x3DAA540);
  42. uint64_t ActorArray = mem->RPM<DWORD_PTR>(DecryptedActorArrayPointer + 0x0, 0x8);
  43. uint64_t ActorCount = mem->RPM<DWORD_PTR>(DecryptedActorArrayPointer + 0x8, 0x8);
  44. if (ActorCount > 0)
  45. {
  46. DrawShadowString(25, 25, 255, 0, 0, pFont, "ACount: %i", ActorCount);
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement