How to merge two scripts in one? (Code Injection)

Dec 16, 2017
70
0
6
#1
Hello Again!
I made a two scripts which I must activated two of them in one moment to get to work in game. I don't know how to merge these two scripts - I tried to rename some functions like: newmem, originalcode, exit... etc. to newmem2, originalcode2... etc. but when I activate my merged script, the game is crashed - but when I activate one script and then another, all it is working perfectly.

How to merge two scripts correctly (code injection scripts) ?? Or maybe there is an easier method to do that, for example maybe with aob injection??

If you have tutorials about that, I will be very happy if someone can share this :)

My scripts:

First Script:
Code:
[ENABLE]
//code from here to '[DISABLE]' will be used to enable the cheat
alloc(newmem,2048)
label(returnhere)
label(originalcode)
label(exit)

newmem: //this is allocated memory, you have read,write,execute access
//place your code here

originalcode:
mov [eax],edx
je Asphalt8.exe+11BA46
add eax,28

exit:
jmp returnhere

"Asphalt8.exe"+11BA33:
jmp newmem
nop
nop
returnhere:


 
 
[DISABLE]
//code from here till the end of the code will be used to disable the cheat
dealloc(newmem)
"Asphalt8.exe"+11BA33:
cmp [eax],edx
je Asphalt8.exe+11BA46
add eax,28
//Alt: db 39 10 74 0F 83 C0 28
Second Script:
Code:
[ENABLE]
//code from here to '[DISABLE]' will be used to enable the cheat
alloc(newmem,2048)
label(returnhere)
label(originalcode)
label(exit)

newmem: //this is allocated memory, you have read,write,execute access
//place your code here

originalcode:
mov [ecx],eax
je Asphalt8.exe+3A05EC

exit:
jmp returnhere

"Asphalt8.exe"+3A0542:
jmp newmem
nop
nop
nop
returnhere:


 
 
[DISABLE]
//code from here till the end of the code will be used to disable the cheat
dealloc(newmem)
"Asphalt8.exe"+3A0542:
cmp [ecx],eax
je Asphalt8.exe+3A05EC
//Alt: db 39 01 0F 84 A2 00 00 00
My merged script (crashing the game):
Code:
[ENABLE]
//code from here to '[DISABLE]' will be used to enable the cheat
alloc(newmem,2048)
label(returnhere)
label(originalcode)
label(exit)

newmem: //this is allocated memory, you have read,write,execute access
//place your code here

originalcode:
mov [eax],edx
je Asphalt8.exe+11BA46
add eax,28

exit:
jmp returnhere

"Asphalt8.exe"+11BA33:
jmp newmem
nop
nop
returnhere:


alloc(newmem2,2048)
label(returnhere2)
label(originalcode2)
label(exit2)

newmem2: //this is allocated memory, you have read,write,execute access
//place your code here

originalcode2:
mov [ecx],eax
je Asphalt8.exe+3A05EC

exit2:
jmp returnhere

"Asphalt8.exe"+3A0542:
jmp newmem
nop
nop
nop
returnhere2:




[DISABLE]
//code from here till the end of the code will be used to disable the cheat
dealloc(newmem)
"Asphalt8.exe"+11BA33:
cmp [eax],edx
je Asphalt8.exe+11BA46
add eax,28

dealloc(newmem2)
"Asphalt8.exe"+3A0542:
cmp [ecx],eax
je Asphalt8.exe+3A05EC
//Alt: db 39 10 74 0F 83 C0 28
 

TheyCallMeTim13

I... am an enchanter.
Talents
Fearless Donors
Mar 3, 2017
338
18
18
#2
Code:
[ENABLE]
//code from here to '[DISABLE]' will be used to enable the cheat
alloc(newmem,2048)
label(returnhere)
label(originalcode)
label(exit)

newmem: //this is allocated memory, you have read,write,execute access
//place your code here

originalcode:
mov [eax],edx
je Asphalt8.exe+11BA46
add eax,28

exit:
jmp returnhere

"Asphalt8.exe"+11BA33:
jmp newmem
nop
nop
returnhere:


alloc(newmem2,2048)
label(returnhere2)
label(originalcode2)
label(exit2)

newmem2: //this is allocated memory, you have read,write,execute access
//place your code here

originalcode2:
mov [ecx],eax
je Asphalt8.exe+3A05EC

exit2:
jmp returnhere

"Asphalt8.exe"+3A0542:
jmp newmem  //<<<<<<<<<<<<<<<< Looks like it should be "newmem2"
nop
nop
nop
returnhere2:




[DISABLE]
//code from here till the end of the code will be used to disable the cheat
dealloc(newmem)
"Asphalt8.exe"+11BA33:
cmp [eax],edx
je Asphalt8.exe+11BA46
add eax,28

dealloc(newmem2)
"Asphalt8.exe"+3A0542:
cmp [ecx],eax
je Asphalt8.exe+3A05EC
//Alt: db 39 10 74 0F 83 C0 28
Line 42
Code:
jmp newmem
Looks like it should be:
Code:
jmp newmem2
EDIT:

use "dealloc" after writing back the bytes in the disable section, so you don't deallocate the memory with a thread that has already jumped to that memory region.