Skip to content

Instantly share code, notes, and snippets.

@devdilson
Created December 31, 2023 23:55
Show Gist options
  • Save devdilson/3f0f57f20d8a0bd3312cdd026544d7bf to your computer and use it in GitHub Desktop.
Save devdilson/3f0f57f20d8a0bd3312cdd026544d7bf to your computer and use it in GitHub Desktop.
-- Cheat Engine Lua Script to Dump a DLL
-- First, identify the target process. You can do this manually in Cheat Engine or use Lua:
local processName = "Kaizen v92.exe" -- Replace with your target process
openProcess(processName)
-- Define the DLL name you want to dump
local dllName = "Client.dll" -- Replace with the name of the DLL you want to dump
-- Function to find the base address of the DLL in the target process
function findDllBaseAddress(dllName)
local modules = enumModules()
for i, module in ipairs(modules) do
if module.Name == dllName then
return module.Address
end
end
return nil
end
-- Function to dump the DLL to a file
function dumpDll(dllName, outputPath)
local baseAddress = findDllBaseAddress(dllName)
if baseAddress == nil then
print("DLL not found: " .. dllName)
return
end
local size = getModuleSize(dllName)
if size == nil then
print("Failed to get the size of the DLL")
return
end
local bytes = readBytes(baseAddress, size, true)
local file = io.open(outputPath, "wb")
for i = 1, #bytes do
file:write(string.char(bytes[i]))
end
file:close()
print("DLL dumped to " .. outputPath)
end
-- Usage example
local outputPath = "C:\\dev\\dumped.dll" -- Replace with your output path
dumpDll(dllName, outputPath)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment