Advertisement
Guest User

AC Cheat

a guest
Feb 24th, 2015
375
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.96 KB | None | 0 0
  1. ------------------------------------------------------------------------------
  2. -- Assaultcube (match client v 1202.2) wallhack cheat by Unarmed
  3. -- notes:
  4. --   only works on 32 bit systems
  5. --   lua ffi is required
  6. ------------------------------------------------------------------------------
  7.  
  8. ffi = require("ffi")
  9.  
  10.  
  11. ffi.cdef[[
  12.   void* FindWindowA    (void*, const char[]);
  13.   void* OpenProcess    (int, int, int);
  14.   int   VirtualProtectEx           (void*, void*, int, int, int*);
  15.   int   GetWindowThreadProcessId   (void*, int*);
  16.   int   WriteProcessMemory         (void*, void*, void*, int, int*);
  17. ]]
  18.  
  19.  
  20. function get_process_handler(wname, permission)
  21.     local hwnd = ffi.C.FindWindowA(nil, wname)
  22.     local res = ffi.cast("void*", 0)
  23.     local tmp = ffi.new("int[1]", 0)
  24.     if tonumber(ffi.cast("int", hwnd)) == 0 then
  25.         return res
  26.     end
  27.     ffi.C.GetWindowThreadProcessId(hwnd, tmp)
  28.     if tmp[0] ~= 0 then
  29.        res = ffi.C.OpenProcess(permission , 0, tmp[0]);
  30.     end
  31.     return res
  32. end
  33.  
  34. function write_memory(hproc, offset, buffer, size)
  35.     local dwprotect = ffi.new("int[1]", 0)
  36.     local offs = ffi.cast("void*", offset)
  37.     if ffi.C.VirtualProtectEx(hproc, offs, size, 4, dwprotect) == 0 then
  38.         return false
  39.     end
  40.     local res = ffi.C.WriteProcessMemory(hproc, offs, buffer, size, nil)
  41.     ffi.C.VirtualProtectEx(hproc, offs, size, 4, dwprotect)
  42.     if res ~= 0 then
  43.         return true
  44.     end
  45.     return false
  46. end
  47.  
  48. hwnd = get_process_handler("AssaultCube", 2035711)
  49. if tonumber(ffi.cast("int", hwnd)) == 0 then
  50.     print("Run the game first, You moron.")
  51.     os.exit()
  52. end
  53. buffer = ffi.new("unsigned char[4]", 0)
  54. buffer[0] = 0x18
  55. buffer[1] = 0x98
  56. buffer[2] = 0x4F
  57. if not write_memory(hwnd, 0x004B9DD8, buffer, 4) then
  58.     os.exit()
  59. end
  60. -- renders the player models even if they are ocluded
  61. if not write_memory(hwnd, 0x004B0B8D, buffer, 4) then
  62.    os.exit()
  63. end
  64.  
  65. print("Done, enable wallhack now (/wallhack 1).")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement