|
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
GH*master Expert Cheater Reputation: 8
Joined: 10 Jan 2008 Posts: 159
|
Posted: Fri Apr 29, 2011 5:15 am Post subject: Function GenerateAAscript() for CE 6.1 |
|
|
I want to initiate this method of generation, but has not worked out quite well.
AAgen.lua:
Code: |
function GenerateAAscript( cheatName, address, injectInstruction, originalcode )
local addressInjection = address
local sumBytes = 0
local originalCodeString = ""
repeat
extrafield, opcode, bytes, address = splitDisassembledString(disassemble(address))
local countBytes = math.floor(string.len (string.gsub(bytes, " ", "")) / 2)
originalCodeString = originalCodeString..[[
]]..opcode
sumBytes = sumBytes +countBytes
address = string.format("%x", ("0x"..address) + countBytes)
until (sumBytes >= 5)
local nopsString = ""
local nopsCount = sumBytes - 5
if (nopsCount>0) then
nopsString = " db"
for i = 1, nopsCount do
nopsString = nopsString.." 90"
end
nopsString = nopsString..[[
]]
end
if (originalcode) then
script =[[
[ENABLE]
alloc(newmem,2048)
label(originalcode)
label(returnhere)
newmem:
]]..injectInstruction..[[
originalcode:]]..originalCodeString.. [[
jmp returnhere
]]..addressInjection..[[:
jmp newmem
]]..nopsString..[[
returnhere:
[DISABLE]
]]..addressInjection..":"..originalCodeString.. [[
dealloc(newmem)
]]
else
script =[[
[ENABLE]
alloc(newmem,2048)
label(returnhere)
newmem:
]]..injectInstruction..[[
jmp returnhere
]]..addressInjection..[[:
jmp newmem
]]..nopsString..[[
returnhere:
[DISABLE]
]]..addressInjection..":"..originalCodeString.. [[
dealloc(newmem)
]]
end
local teSlave = getTableEntry(cheatName)
if (teSlave == nil) then
teSlave = addresslist_createMemoryRecord(addresslist)
memoryrecord_setDescription(teSlave, cheatName)
memoryrecord_setType(teSlave, vtAutoAssembler)
end
memoryrecord_setScript(teSlave, script)
end
|
Run this sript:
Code: |
require("AAgen")
processName = "Test.exe"
function Initialize()
GenerateAAscript("Test", [["Test.exe"+54650]], [[mov [0045B5A4],#10000]], true )
-- any of your many scripts GenerateAAscript(...)
end
aalist = getAutoAttachList()
stringlist_add(aalist,processName);
function onOpenProcess(processid)
if (attach) then
return
end
attach = true
openProcess(processid)
Initialize()
end
|
Result:
Code: |
[ENABLE]
alloc(newmem,2048)
label(originalcode)
label(returnhere)
newmem:
mov [0045B5A4],#10000
originalcode:
mov eax,[0045B5A4]
jmp returnhere
"Test.exe"+54650:
jmp newmem
db 90 90 90 90 90
returnhere:
[DISABLE]
"Test.exe"+54650:
mov eax,[0045B5A4]
dealloc(newmem)
|
LUA script does not always work correctly and you can fix it.
Last edited by GH*master on Thu May 05, 2011 12:57 am; edited 2 times in total |
|
Back to top |
|
|
GH*master Expert Cheater Reputation: 8
Joined: 10 Jan 2008 Posts: 159
|
Posted: Thu May 05, 2011 12:55 am Post subject: |
|
|
Attention! First post has been updated ... Many fixes
|
|
Back to top |
|
|
GH*master Expert Cheater Reputation: 8
Joined: 10 Jan 2008 Posts: 159
|
Posted: Tue May 31, 2011 4:00 am Post subject: |
|
|
For private CE 6.1 RC2
New LUA-script generation of AA-script into a single virtual memory
Example Started:
Code: | bufScript = BeginGenerateAAscriptAggregateMem("allocMem","2048")
bufScript = GenerateAAscriptAggregateMem(bufScript, "infGold", "0045464A", "xor eax, eax", true )
bufScript = GenerateAAscriptAggregateMem(bufScript, "infMana", "00454650", "xor ebx, ebx", true )
bufScript = EndGenerateAAscriptAggregateMem(bufScript)
showMessage(bufScript)
autoAssemble(bufScript) |
Necessary additions:
Code: | function BeginGenerateAAscriptAggregateMem(newMemDescription, sizeMem)
return [[
alloc(]]..newMemDescription..","..sizeMem..[[)
->>label]]..newMemDescription..[[:
->>newCode
->>adressessInjected
]]
end
function EndGenerateAAscriptAggregateMem(aggregateMem)
local endScript = string.gsub(aggregateMem, "->>label", "")
endScript = string.gsub(endScript, "->>newCode", "")
endScript = string.gsub(endScript, "->>adressessInjected", "")
return endScript
end
local function preSubScript(script, patternWord, newWords)
local index = string.find(script, patternWord)
local newscript = string.sub(script, 1, index - 1)..newWords.."\n"..string.sub(script, index)
return newscript
end
function GenerateAAscriptAggregateMem(aggregateMem, cheatName, address, newCode, stateOriginalCode)
local addressInjection = address
local sumBytes = 0
local originalCodeString = " "
repeat
local countBytes = getInstructionSize(address)
extrafield, opcode, bytes, address = splitDisassembledString(disassemble(address))
originalCodeString = originalCodeString.."\n "..opcode
sumBytes = sumBytes +countBytes
addressBehindNops = string.format("%x", ("0x"..address) + countBytes)
until (sumBytes >= 5)
local nopsString = ""
local nopsCount = sumBytes - 5
if (nopsCount>0) then
nopsString = " db"
for i = 1, nopsCount do
nopsString = nopsString.." 90"
end
nopsString = nopsString..[[
]]
end
local script = preSubScript(aggregateMem,"->>label", "label("..cheatName..")")
script = preSubScript(script,"->>label", "registersymbol("..cheatName..")")
registerSymbol("returnHere_"..cheatName, addressBehindNops)
if (stateOriginalCode) then
script = preSubScript(script,"->>label", "label(originalcode_"..cheatName..")")
local buf = cheatName..":\n "..newCode.."\noriginalcode_"..cheatName..":"..originalCodeString.."\n jmp returnHere_"..cheatName
script = preSubScript(script,"->>newCode", buf)
else
script = preSubScript(script,"->>newCode", cheatName..":\n"..newCode.."\n jmp returnHere_"..cheatName)
end
local scriptAddMainTable = "[ENABLE]\n-->>address1[DISABLE]\n-->>address2"
scriptAddMainTable = preSubScript(scriptAddMainTable,"-->>address1", addressInjection..":\njmp "..cheatName.."\n"..nopsString)
scriptAddMainTable = preSubScript(scriptAddMainTable,"-->>address2", addressInjection..":"..originalCodeString)
scriptAddMainTable = string.gsub(scriptAddMainTable, "-->>address1", "")
scriptAddMainTable = string.gsub(scriptAddMainTable, "-->>address2", "")
local teSlave = getTableEntry(cheatName)
if (teSlave == nil) then
teSlave = addresslist_createMemoryRecord(addresslist)
memoryrecord_setDescription(teSlave, cheatName)
memoryrecord_setType(teSlave, vtAutoAssembler)
end
memoryrecord_setScript(teSlave, scriptAddMainTable)
return script
end |
Enjoy
|
|
Back to top |
|
|
ablonevn Advanced Cheater Reputation: 1
Joined: 02 Oct 2011 Posts: 59
|
Posted: Wed Jan 16, 2013 1:01 am Post subject: |
|
|
thanks, i think, you will add menu item "GH autoassambler" to same location of auto assambler is very comforable to user, and add ability to merge multi assembler into single one is another option.
|
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum
|
|