Difference between revisions of "Cheat Engine:Auto Assembler"

From Cheat Engine
Jump to navigation Jump to search
(some linebreaks)
Line 2: Line 2:
 
Auto assemble allows you to write assembler code at different locations using a script. It can be found in the memory view part of cheat engine under extra.
 
Auto assemble allows you to write assembler code at different locations using a script. It can be found in the memory view part of cheat engine under extra.
  
There are 3 special commands you can give it, ALLOC , LABEL and FULLACCESS. With LABEL you can give a address a name by declaring it before you use it. ALLOC is basicly the same as LABEL but allocates some memory for you.
+
There are 3 special commands you can give it, ALLOC , LABEL and FULLACCESS. With LABEL you can give a address a name by declaring it before you use it. ALLOC is basicly the same as LABEL but allocates some memory for you.<br>
Usage:  
+
Usage: <br>
LABEL(labelname) //Enables the word labelname to be used as a address
+
LABEL(labelname) //Enables the word labelname to be used as a address<br>
ALLOC(allocname,sizeinbytes) //same as label, but allocates the memory it points to itself
+
ALLOC(allocname,sizeinbytes) //same as label, but allocates the memory it points to itself<br>
DEALLOC(allocname) //Deallocates a block of memory allocated with alloc. It always gets executed last, no matter where it is positioned in the code, and only actually frees the memory when all allocations have been freed.  only usable in a script designed as cheattable. (e.g used for the disable cheat)
+
DEALLOC(allocname) //Deallocates a block of memory allocated with alloc. It always gets executed last, no matter where it is positioned in the code, and only actually frees the memory when all allocations have been freed.  only usable in a script designed as cheattable. (e.g used for the disable cheat)<br>
FULLACCESS(address,size)  //makes a memory region at the specified address and at least "size" bytes readable, writable and executable
+
FULLACCESS(address,size)  //makes a memory region at the specified address and at least "size" bytes readable, writable and executable<br>
 +
<br>
 +
REGISTERSYMBOL(symboname) //adds the symbol to the userdefined symbol list so cheattables and the memory browser can use that name instead of a address (The symbol has to be declared in the script when using it)<br>
 +
UNREGISTERSYMBOL(symbolname) //removes the symbol from the userdefined symbol list. It won't give a error if it isn't found<br>
  
REGISTERSYMBOL(symboname) //adds the symbol to the userdefined symbol list so cheattables and the memory browser can use that name instead of a address (The symbol has to be declared in the script when using it)
 
UNREGISTERSYMBOL(symbolname) //removes the symbol from the userdefined symbol list. It won't give a error if it isn't found
 
  
 
+
DEFINE(name,whatever) :Will replace all tokens with the specified name with the text of whatever<br>
DEFINE(name,whatever) :Will replace all tokens with the specified name with the text of whatever
+
INCLUDE(filename) :includes another auto assembler file at that spot<br>
INCLUDE(filename) :includes another auto assembler file at that spot
+
LOADBINARY(address,filename) :Will load a binary file at the specified address<br>
LOADBINARY(address,filename) :Will load a binary file at the specified address
+
CREATETHREAD(address) :Will spawn a thread in the process at the specified address<br>
CREATETHREAD(address) :Will spawn a thread in the process at the specified address
+
LOADLIBRARY(filename) :Will inject the specified dll into the target process<br>
LOADLIBRARY(filename) :Will inject the specified dll into the target process
+
READMEM(address,size) :Will write the addresses at address at the location this instruction is placed<br>
READMEM(address,size) :Will write the addresses at address at the location this instruction is placed
 
  
  
 
GLOBALALLOC(name,size) : Will allocate a certain amount of memory and registers the specified name. Using GlobalAlloc in other scripts will then not allocate the memory again, but reuse the already existing memory. (Or allocate it anyhow if found it wasn't allocated yet)
 
GLOBALALLOC(name,size) : Will allocate a certain amount of memory and registers the specified name. Using GlobalAlloc in other scripts will then not allocate the memory again, but reuse the already existing memory. (Or allocate it anyhow if found it wasn't allocated yet)
  
Basic Example:
+
Basic Example:<br>
00451029:
+
00451029:<br>
jmp 00410000
+
jmp 00410000<br>
nop
+
nop<br>
nop
+
nop<br>
nop
+
nop<br>
 
+
<br>
00410000:
+
00410000:<br>
mov [00580120],esi
+
mov [00580120],esi<br>
mov [esi+80],ebx
+
mov [esi+80],ebx<br>
xor eax,eax
+
xor eax,eax<br>
jmp 00451031
+
jmp 00451031<br>
 
+
<br>
Example using LABEL:
+
Example using LABEL:<br>
label(mylabel)
+
label(mylabel)<br>
 
+
<br>
00451029:
+
00451029:<br>
jmp 00410000
+
jmp 00410000<br>
nop
+
nop<br>
nop
+
nop<br>
nop
+
nop<br>
mylabel:
+
mylabel:<br>
 
+
<br>
00410000:
+
00410000:<br>
mov [00580120],esi
+
mov [00580120],esi<br>
mov [esi+80],ebx
+
mov [esi+80],ebx<br>
xor eax,eax
+
xor eax,eax<br>
jmp mylabel
+
jmp mylabel<br>
 
+
<br>
Example using ALLOC:
+
Example using ALLOC:<br>
alloc(memloc1,4)
+
alloc(memloc1,4)<br>
 
+
<br>
00451029:
+
00451029:<br>
jmp 00410000
+
jmp 00410000<br>
nop
+
nop<br>
nop
+
nop<br>
nop
+
nop<br>
 
+
<br>
00410000:
+
00410000:<br>
mov [alloc1],esi
+
mov [alloc1],esi<br>
mov [esi+80],ebx
+
mov [esi+80],ebx<br>
xor eax,eax
+
xor eax,eax<br>
jmp 00451031
+
jmp 00451031<br>
 
+
<br>
Example using ALLOC and LABEL
+
Example using ALLOC and LABEL<br>
alloc(alloc1,4)
+
alloc(alloc1,4)<br>
label(mylabel)
+
label(mylabel)<br>
 
+
<br>
00451029:
+
00451029:<br>
jmp 00410000
+
jmp 00410000<br>
nop
+
nop<br>
nop
+
nop<br>
nop
+
nop<br>
mylabel:
+
mylabel:<br>
 
+
<br>
00410000:
+
00410000:<br>
mov [alloc1],esi
+
mov [alloc1],esi<br>
mov [esi+80],ebx
+
mov [esi+80],ebx<br>
xor eax,eax
+
xor eax,eax<br>
jmp mylabel
+
jmp mylabel<br>
 
 
  
Example using FULLACCESS
 
FULLACCESS(00400800,4) //00400800 is usually read only non executable data, this makes it writeable and executable
 
00451029:
 
jmp 00410000
 
nop
 
nop
 
nop
 
  
00410000:
+
Example using FULLACCESS<br>
mov [00400800],esi
+
FULLACCESS(00400800,4) //00400800 is usually read only non executable data, this makes it writeable and executable<br>
mov [esi+80],ebx
+
00451029:<br>
xor eax,eax
+
jmp 00410000<br>
jmp 00451031
+
nop<br>
 +
nop<br>
 +
nop<br>
  
Example using DEFINE
+
00410000:<br>
DEFINE(clear_eax,xor eax,eax)
+
mov [00400800],esi<br>
00400500:
+
mov [esi+80],ebx<br>
clear_eax
+
xor eax,eax<br>
 +
jmp 00451031<br>
  
ReadMem example
+
Example using DEFINE<br>
alloc(x,16)
+
DEFINE(clear_eax,xor eax,eax)<br>
alloc(script,2048)
+
00400500:<br>
 +
clear_eax<br>
  
script:
+
ReadMem example<br>
mov eax,[x]
+
alloc(x,16)<br>
mov edx,[x+c]
+
alloc(script,2048)<br>
ret
 
  
x:
+
script:<br>
readmem(00410000,16) //place the contents of address 00410000 at the address of X
+
mov eax,[x]<br>
 +
mov edx,[x+c]<br>
 +
ret<br>
  
----
+
x:<br>
 +
readmem(00410000,16) //place the contents of address 00410000 at the address of X<br>

Revision as of 23:28, 29 July 2009

Template:cleanup Auto assemble allows you to write assembler code at different locations using a script. It can be found in the memory view part of cheat engine under extra.

There are 3 special commands you can give it, ALLOC , LABEL and FULLACCESS. With LABEL you can give a address a name by declaring it before you use it. ALLOC is basicly the same as LABEL but allocates some memory for you.
Usage:
LABEL(labelname) //Enables the word labelname to be used as a address
ALLOC(allocname,sizeinbytes) //same as label, but allocates the memory it points to itself
DEALLOC(allocname) //Deallocates a block of memory allocated with alloc. It always gets executed last, no matter where it is positioned in the code, and only actually frees the memory when all allocations have been freed. only usable in a script designed as cheattable. (e.g used for the disable cheat)
FULLACCESS(address,size) //makes a memory region at the specified address and at least "size" bytes readable, writable and executable

REGISTERSYMBOL(symboname) //adds the symbol to the userdefined symbol list so cheattables and the memory browser can use that name instead of a address (The symbol has to be declared in the script when using it)
UNREGISTERSYMBOL(symbolname) //removes the symbol from the userdefined symbol list. It won't give a error if it isn't found


DEFINE(name,whatever) :Will replace all tokens with the specified name with the text of whatever
INCLUDE(filename) :includes another auto assembler file at that spot
LOADBINARY(address,filename) :Will load a binary file at the specified address
CREATETHREAD(address) :Will spawn a thread in the process at the specified address
LOADLIBRARY(filename) :Will inject the specified dll into the target process
READMEM(address,size) :Will write the addresses at address at the location this instruction is placed


GLOBALALLOC(name,size) : Will allocate a certain amount of memory and registers the specified name. Using GlobalAlloc in other scripts will then not allocate the memory again, but reuse the already existing memory. (Or allocate it anyhow if found it wasn't allocated yet)

Basic Example:
00451029:
jmp 00410000
nop
nop
nop

00410000:
mov [00580120],esi
mov [esi+80],ebx
xor eax,eax
jmp 00451031

Example using LABEL:
label(mylabel)

00451029:
jmp 00410000
nop
nop
nop
mylabel:

00410000:
mov [00580120],esi
mov [esi+80],ebx
xor eax,eax
jmp mylabel

Example using ALLOC:
alloc(memloc1,4)

00451029:
jmp 00410000
nop
nop
nop

00410000:
mov [alloc1],esi
mov [esi+80],ebx
xor eax,eax
jmp 00451031

Example using ALLOC and LABEL
alloc(alloc1,4)
label(mylabel)

00451029:
jmp 00410000
nop
nop
nop
mylabel:

00410000:
mov [alloc1],esi
mov [esi+80],ebx
xor eax,eax
jmp mylabel


Example using FULLACCESS
FULLACCESS(00400800,4) //00400800 is usually read only non executable data, this makes it writeable and executable
00451029:
jmp 00410000
nop
nop
nop

00410000:
mov [00400800],esi
mov [esi+80],ebx
xor eax,eax
jmp 00451031

Example using DEFINE
DEFINE(clear_eax,xor eax,eax)
00400500:
clear_eax

ReadMem example
alloc(x,16)
alloc(script,2048)

script:
mov eax,[x]
mov edx,[x+c]
ret

x:
readmem(00410000,16) //place the contents of address 00410000 at the address of X