Advertisement
xosski

Lua memory script with game guardian addon(game hacking and other fun)

Jan 1st, 2025
19
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.48 KB | None | 0 0
  1. --[[
  2. Improved Lua Script
  3. Features: Encoding/Decoding, File Handling, Key Management, Memory Patching
  4. Author: [Xosski/Shestus]
  5. Date: [1.1.25]
  6. --]]
  7.  
  8. -- Utility Functions
  9. local function wrapAround(code)
  10. return (code % 256)
  11. end
  12.  
  13. local function encodeChar(char, shift)
  14. local code = string.byte(char)
  15. local newCode = wrapAround(code + shift)
  16. return string.char(newCode)
  17. end
  18.  
  19. local function decodeChar(char, shift)
  20. local code = string.byte(char)
  21. local newCode = wrapAround(code - shift)
  22. return string.char(newCode)
  23. end
  24.  
  25. local function transformString(input, shift, operation)
  26. local result = {}
  27. for i = 1, #input do
  28. local char = input:sub(i, i)
  29. if operation == "encode" then
  30. result[i] = encodeChar(char, shift)
  31. else
  32. result[i] = decodeChar(char, shift)
  33. end
  34. end
  35. return table.concat(result)
  36. end
  37.  
  38. local function encode(input)
  39. return transformString(input, 1, "encode")
  40. end
  41.  
  42. local function decode(input)
  43. return transformString(input, 1, "decode")
  44. end
  45.  
  46. -- File Handling Functions
  47. local function fileExists(path)
  48. local file = io.open(path, "r")
  49. if file then
  50. file:close()
  51. return true
  52. else
  53. return false
  54. end
  55. end
  56.  
  57. local function writeFile(path, content)
  58. local file = io.open(path, "w")
  59. if file then
  60. file:write(content)
  61. file:close()
  62. return true
  63. else
  64. return false
  65. end
  66. end
  67.  
  68. local function readFile(path)
  69. local file = io.open(path, "r")
  70. if file then
  71. local content = file:read("*all")
  72. file:close()
  73. return content
  74. else
  75. return nil
  76. end
  77. end
  78.  
  79. -- Key Management
  80. local function generateRandomPassword(length)
  81. local chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
  82. local password = ""
  83. math.randomseed(os.time())
  84. for i = 1, length do
  85. local index = math.random(1, #chars)
  86. password = password .. chars:sub(index, index)
  87. end
  88. return password
  89. end
  90.  
  91. local function manageKey(filePath)
  92. if not fileExists(filePath) then
  93. local password = generateRandomPassword(9)
  94. local encodedPassword = encode(password)
  95. writeFile(filePath, encodedPassword)
  96. print("New key generated and saved:", password)
  97. else
  98. local encodedPassword = readFile(filePath)
  99. if encodedPassword then
  100. local password = decode(encodedPassword)
  101. print("Existing key:", password)
  102. else
  103. print("Error reading the key file.")
  104. end
  105. end
  106. end
  107.  
  108. -- Memory Patching Functions (Example)
  109. local function patchMemory(address, value)
  110. -- Simulated memory patching (for demonstration purposes)
  111. print(string.format("Patching memory at address 0x%X with value: %s", address, value))
  112. -- Implement your actual memory patching logic here, if needed.
  113. end
  114.  
  115. local function performMemoryPatches()
  116. local patches = {
  117. {address = 0x1000, value = "0xFF"},
  118. {address = 0x2000, value = "0xAB"},
  119. {address = 0x3000, value = "0x45"}
  120. }
  121.  
  122. for _, patch in ipairs(patches) do
  123. patchMemory(patch.address, patch.value)
  124. end
  125. end
  126.  
  127. -- Main Execution
  128. local keyFilePath = "/sdcard/DCIM/.keyfile"
  129. manageKey(keyFilePath)
  130. performMemoryPatches()
  131.  
  132. /////////////
  133. Game guardian
  134. -- GameGuardian Script with User Menu and Search Example
  135.  
  136. -- Function to generate a unique hardware ID (HWID)
  137. function generate_hwid()
  138. local chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
  139. local hwid = ""
  140. for i = 1, 16 do
  141. local rand = math.random(1, #chars)
  142. hwid = hwid .. chars:sub(rand, rand)
  143. end
  144. return hwid
  145. end
  146.  
  147. -- HWID generation
  148. local hwid = generate_hwid()
  149. gg.toast("Generated HWID: " .. hwid)
  150.  
  151. -- Main menu function
  152. function main_menu()
  153. local menu = gg.choice({
  154. "1. Search and Modify Value",
  155. "2. Exit"
  156. }, nil, "GameGuardian Script Menu")
  157.  
  158. if menu == 1 then
  159. search_and_modify()
  160. elseif menu == 2 then
  161. gg.toast("Exiting script.")
  162. os.exit()
  163. else
  164. gg.toast("Invalid choice. Please try again.")
  165. main_menu()
  166. end
  167. end
  168.  
  169. -- Function to search and modify a value in memory
  170. function search_and_modify()
  171. gg.toast("Starting search...")
  172.  
  173. -- Input for the value to search
  174. local value = gg.prompt({"Enter the value to search:"}, {[1] = 0}, {[1] = "number"})
  175.  
  176. if value == nil or value[1] == 0 then
  177. gg.toast("Invalid input or canceled. Returning to menu.")
  178. main_menu()
  179. end
  180.  
  181. -- Search for the value
  182. gg.searchNumber(value[1], gg.TYPE_DWORD)
  183. local results = gg.getResultsCount()
  184.  
  185. if results == 0 then
  186. gg.toast("No results found for value: " .. value[1])
  187. main_menu()
  188. else
  189. gg.toast("Found " .. results .. " results for value: " .. value[1])
  190.  
  191. -- Modify the values
  192. local modify = gg.prompt({"Enter the new value:"}, {[1] = 0}, {[1] = "number"})
  193. if modify == nil or modify[1] == 0 then
  194. gg.toast("Invalid input or canceled. Returning to menu.")
  195. main_menu()
  196. end
  197.  
  198. gg.getResults(results)
  199. gg.editAll(modify[1], gg.TYPE_DWORD)
  200. gg.toast("Modified all results to: " .. modify[1])
  201. end
  202.  
  203. main_menu()
  204. end
  205.  
  206. -- Start the script by calling the main menu
  207. main_menu()
  208.  
  209.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement