Advertisement
LordEzz7

a

Jul 11th, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.80 KB | None | 0 0
  1. namespace RBLX_RLUAMAIN {
  2.  
  3. typedef void(__fastcall* RBLOX_getfield_)(int RBLX_State, int idx, const char* k); // C
  4. typedef int(__stdcall* RBLOX_getmetatable_)(int RBLX_State, int idx); // C
  5. typedef void(__fastcall* RBLOX_pushstring_)(int RBLX_State, const char* s); // C
  6. typedef void(__stdcall* RBLOX_pushvalue_)(int RBLX_State, int idx); // C
  7. typedef int(__cdecl* RBLOX_pcall_)(int RBLX_State, int nargs, int nret, int errfunc); // C
  8. typedef void(__cdecl* RBLOX_setfield_)(int RBLX_State, int idx, const char* k); // C IDK HOW
  9. typedef void(__thiscall* RBLOX_pushnumber_)(int RBLX_State, double n); // C
  10. typedef const char*(__cdecl* RBLOX_tolstring_)(int RBLX_State, int idx, int asd); // C
  11. typedef int(__cdecl* RBLOX_toboolean_)(int RBLX_State, int idx); // C
  12. typedef void(__cdecl* RBLOX_settop_)(int RBLX_State, int top); // C
  13. typedef int(__cdecl* RBLOX_next_)(int lua_State, int something); // C
  14. typedef int*(__cdecl* RBLOX_getcontext_)();
  15.  
  16. // im just dumb /shrug
  17.  
  18.  
  19. RBLOX_settop_ RBLOX_settop;
  20. RBLOX_getfield_ RBLOX_getfield;
  21. RBLOX_pushstring_ RBLOX_pushstring;
  22. RBLOX_pushvalue_ RBLOX_pushvalue;
  23. RBLOX_pcall_ RBLOX_pcall;
  24. RBLOX_setfield_ RBLOX_setfield;
  25. RBLOX_pushnumber_ RBLOX_pushnumber;
  26. RBLOX_tolstring_ RBLOX_tolstring;
  27. RBLOX_toboolean_ RBLOX_toboolean;
  28. RBLOX_getmetatable_ RBLOX_getmetatable;
  29. RBLOX_next_ RBLOX_next;
  30. RBLOX_getcontext_ RBLOX_getcontext;
  31.  
  32. void RBLOX_POP(int RbxState, int n);
  33.  
  34.  
  35. void INTILIZING() {
  36. RBLOX_getmetatable = (RBLOX_getmetatable_)unprotect(aslr(RBLOX_GetMetatable));
  37. RBLOX_settop = (RBLOX_settop_)unprotect(aslr(RBLOX_Settop));
  38. RBLOX_getfield = (RBLOX_getfield_)unprotect(aslr(RBLOX_GetField));
  39. RBLOX_pushstring = (RBLOX_pushstring_)unprotect(aslr(RBLOX_Pushstring));
  40. RBLOX_pushvalue = (RBLOX_pushvalue_)unprotect(aslr(RBLOX_Pushvalue));
  41. RBLOX_pcall = (RBLOX_pcall_)unprotect(aslr(RBLOX_Pcall));
  42. RBLOX_setfield = (RBLOX_setfield_)unprotect(aslr(RBLOX_Setfield));
  43. RBLOX_pushnumber = (RBLOX_pushnumber_)unprotect(aslr(RBLOX_Pushnumber));
  44. RBLOX_tolstring = (RBLOX_tolstring_)unprotect(aslr(RBLOX_tolString));
  45. RBLOX_toboolean = (RBLOX_toboolean_)unprotect(aslr(RBLOX_toBoolean));
  46. RBLOX_next = (RBLOX_next_)unprotect(aslr(RBLOX_Next));
  47. // RBLOX_getcontext = (RBLOX_getcontext_)aslr(RBLOX_contextlevel);
  48.  
  49. }
  50. // BYPASSES
  51.  
  52. void jnz(int addr) {
  53. DWORD o_buff;
  54. VirtualProtect((void*)addr, 5, PAGE_EXECUTE_READWRITE, &o_buff);
  55. *(char*)addr = 0x75;
  56. VirtualProtect((void*)addr, 5, o_buff, &o_buff);
  57. }
  58.  
  59. void jz(int addr) {
  60. DWORD o_buff;
  61. VirtualProtect((void*)addr, 5, PAGE_EXECUTE_READWRITE, &o_buff);
  62. *(char*)addr = 0x74;
  63. VirtualProtect((void*)addr, 5, o_buff, &o_buff);
  64. }
  65.  
  66. void set() {
  67. jnz(aslr(RARJZ_Bypass));
  68. }
  69.  
  70. void restore() {
  71. jz(aslr(RARJZ_Bypass));
  72. }
  73.  
  74. int RBLX_GetMetatable(int RbxState, int idx) {
  75. set();
  76. int ret = RBLOX_getmetatable(RbxState, idx);
  77. restore();
  78. return ret;
  79. }
  80.  
  81. void RBLX_Settop(int RbxState, int top) {
  82. set();
  83. RBLOX_settop(RbxState, top);
  84. restore();
  85. }
  86.  
  87. void RBLX_Getfield(int RbxState, int idx, const char* k) {
  88. set();
  89. RBLOX_getfield(RbxState, idx, k);
  90. restore();
  91. }
  92.  
  93. void RBLX_pushstring(int RbxState, const char* k) {
  94. set();
  95. RBLOX_pushstring(RbxState, k);
  96. restore();
  97. }
  98.  
  99. void RBLX_pushvalue(int RbxState, int idx) {
  100. set();
  101. RBLOX_pushvalue(RbxState, idx);
  102. restore();
  103. }
  104.  
  105. int RBLX_pcall(int RbxState, int nargs, int nret, int errfunc) {
  106. set();
  107. int ret = RBLOX_pcall(RbxState, nargs, nret, errfunc);
  108. restore();
  109. return ret;
  110. }
  111.  
  112. void RBLX_pushnumber(int RbxState, double n) {
  113. set();
  114. RBLOX_pushnumber(RbxState, n);
  115. restore();
  116. }
  117.  
  118. const char* RBLX_tostring(int RbxState, int idx) {
  119. set();
  120. const char* ret = RBLOX_tolstring(RbxState, idx, 0);
  121. restore();
  122. return ret;
  123. }
  124.  
  125. int RBLX_toboolean(int RbxState, int idx) {
  126. set();
  127. int ret = RBLOX_toboolean(RbxState, idx);
  128. restore();
  129. return ret;
  130. }
  131.  
  132. int RBLX_next(int RbxState, int something) {
  133. set();
  134. int ret = RBLOX_next(RbxState, something);
  135. restore();
  136. return ret;
  137. }
  138.  
  139. void RBLX_pop(int RbxState, int n) {
  140. RBLX_Settop(RbxState, -(n)-1);
  141. }
  142.  
  143. void RBLX_pushnil(int RbxState) {
  144. *(DWORD*)(*(DWORD*)(RbxState + 24) + 8) = 0;
  145. *(DWORD*)(RbxState + 24) += 16;
  146. }
  147.  
  148. void RBLX_getglobal(int RbxState, const char* k) {
  149. RBLX_Getfield(RbxState, -10002, k);
  150. }
  151.  
  152. void RBLX_setfield(int RbxState, int idx, const char* k) {
  153. RBLX_pushvalue(RbxState, idx);
  154. if (RBLX_GetMetatable(RbxState, -1)) {
  155. RBLX_Getfield(RbxState, -1, "__newindex");
  156. RBLX_pushvalue(RbxState, -3);
  157. RBLX_pushstring(RbxState, k);
  158. RBLX_pushvalue(RbxState, -6);
  159. RBLX_pcall(RbxState, 3, 0, 0);
  160. RBLX_pop(RbxState, 3);
  161. }
  162. else {
  163. RBLX_pop(RbxState, 1);
  164. set();
  165. RBLOX_setfield(RbxState, idx, k);
  166. restore();
  167. }
  168. }
  169. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement