Page 1 of 2

Where Can I find tutorial about making an EDIT BOX to Code Injection?

Posted: Tue Jan 09, 2018 7:48 pm
by marek1957
Hello,
I was searching for a tutorial to learn how to make a working edit box for my code injection script. I have a script that you can change the amount of racers when you are racing, but I want to make a possibility that I will write a number on edit box and then freeze address and the written value will be activated in game. I dont know how to do this, is there any tutorial about that to learn that method?

I wanna use this method in my Code Injection Script.

My script:

Code: Select all

[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
mov [edi+2C],#24
originalcode:
mov eax,[edi+2C]
mov [esi+2C],eax

exit:
jmp returnhere

"Asphalt8.exe"+8710E:
jmp newmem
nop
returnhere:




[DISABLE]
//code from here till the end of the code will be used to disable the cheat
dealloc(newmem)
"Asphalt8.exe"+8710E:
mov eax,[edi+2C]
mov [esi+2C],eax
//Alt: db 8B 47 2C 89 46 2C

Re: Where Can I find tutorial about making an EDIT BOX to Code Injection?

Posted: Tue Jan 09, 2018 7:58 pm
by Blayde
marek1957 wrote:
Tue Jan 09, 2018 7:48 pm
Hello,
I was searching for a tutorial to learn how to make a working edit box for my code injection script. I have a script that you can change the amount of racers when you are racing, but I want to make a possibility that I will write a number on edit box and then freeze address and the written value will be activated in game. I dont know how to do this, is there any tutorial about that to learn that method?

I wanna use this method in my Code Injection Script.
You need edit box + check box ( to freeze address ).
Search on CE forum.

And you must delete this: mov [edi+2C],#24
or edit box will be useless.

Re: Where Can I find tutorial about making an EDIT BOX to Code Injection?

Posted: Tue Jan 09, 2018 10:41 pm
by marek1957
Bro, I now that I need to have edit box + check box. But I don't know how change the function to working with. I was trying to add globalalloc(this,4) for example and then i was trying : mov [edi+2C],(this) - but this is not working. I don't know how to write a correct function.

Re: Where Can I find tutorial about making an EDIT BOX to Code Injection?

Posted: Tue Jan 09, 2018 10:53 pm
by TimFun13
So you you need to look in to and experiment with:
Lua Classes: Timer, CheatComponent
Lua Functions: readPointer, writeInteger, autoAssemble

But not really any tutorials that I know of.

I think the CheatComponent has an edit box, check box, and can freeze values, so I would start there for what you are doing. But I have not messed with it my self.

Re: Where Can I find tutorial about making an EDIT BOX to Code Injection?

Posted: Tue Jan 09, 2018 11:13 pm
by marek1957
Ok, I am kinda sad that there isn't any tutorials how to do it :-(

Re: Where Can I find tutorial about making an EDIT BOX to Code Injection?

Posted: Tue Jan 09, 2018 11:48 pm
by Acido

Code: Select all

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

newmem: //this is allocated memory, you have read,write,execute access
//place your code here
mov eax,[myEdit]
cmp eax,0
je originalcode
mov [edi+2C],eax
originalcode:
mov eax,[edi+2C]
mov [esi+2C],eax

exit:
jmp returnhere

myEdit:
  dd 0

"Asphalt8.exe"+8710E:
jmp newmem
nop
returnhere:

[DISABLE]
//code from here till the end of the code will be used to disable the cheat
dealloc(newmem)
unregistersymbol(myEdit)

"Asphalt8.exe"+8710E:
mov eax,[edi+2C]
mov [esi+2C],eax
//Alt: db 8B 47 2C 89 46 2C
--

Add a new entry in table, under Address type: myEdit set it to 4 bytes. You do not need to freeze it either, just type your value you want into it.

Re: Where Can I find tutorial about making an EDIT BOX to Code Injection?

Posted: Wed Jan 10, 2018 12:14 am
by marek1957
hey Acido! Thank you for your help! It is working perfectly!!!!

I was trying to do the same with number of LAPS but when I freeze the script - I am instantly ending the race! Then when I unfreeze the script and do again the race, I will have a number of laps that I wrote. Why is that happening?

Original script of number of laps (code injecion):

Code: Select all

[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 [esi+18],#24
mov eax,[edi+1C]

exit:
jmp returnhere

"Asphalt8.exe"+870F3:
jmp newmem
nop
returnhere:


 
 
[DISABLE]
//code from here till the end of the code will be used to disable the cheat
dealloc(newmem)
"Asphalt8.exe"+870F3:
mov [esi+18],eax
mov eax,[edi+1C]
//Alt: db 89 46 18 8B 47 1C 89 46 1C 8B 47 20
My changed script like yours ACIDO but something is wrong..:

Code: Select all

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

newmem: //this is allocated memory, you have read,write,execute access
//place your code here
mov eax,[mama]
cmp eax,0
je exit
mov [esi+1C],eax
originalcode:
mov eax,[edi+18]
mov [esi+1C],eax

exit:
jmp returnhere

mama:
 dd 0

"Asphalt8.exe"+870F3:
jmp newmem
nop
returnhere:


 
 
[DISABLE]
//code from here till the end of the code will be used to disable the cheat
dealloc(newmem)
unregistersymbol(mama)

"Asphalt8.exe"+870F3:
mov [esi+18],eax
mov eax,[edi+1C]
//Alt: db 89 46 18 8B 47 1C 89 46 1C 8B 47 20

Re: Where Can I find tutorial about making an EDIT BOX to Code Injection?

Posted: Wed Jan 10, 2018 12:24 am
by Blayde
marek1957 wrote:
Tue Jan 09, 2018 10:41 pm
Bro, I now that I need to have edit box + check box. But I don't know how change the function to working with. I was trying to add globalalloc(this,4) for example and then i was trying : mov [edi+2C],(this) - but this is not working. I don't know how to write a correct function.
Ok. What are we talking about ?
Trainer or script ?

Re: Where Can I find tutorial about making an EDIT BOX to Code Injection?

Posted: Wed Jan 10, 2018 1:44 am
by sbryzl
One of these is wrong. They should be the same.

Code: Select all

originalcode:
mov eax,[edi+18]
mov [esi+1C],eax

Code: Select all

"Asphalt8.exe"+870F3:
mov [esi+18],eax
mov eax,[edi+1C]

Re: Where Can I find tutorial about making an EDIT BOX to Code Injection?

Posted: Wed Jan 10, 2018 2:23 am
by Blayde
marek1957 wrote:
Wed Jan 10, 2018 12:14 am
hey Acido! Thank you for your help! It is working perfectly!!!!

I was trying to do the same with number of LAPS but when I freeze the script - I am instantly ending the race! Then when I unfreeze the script and do again the race, I will have a number of laps that I wrote. Why is that happening?
Try:

Code: Select all

[ENABLE]
alloc(newmem,2048)
alloc(mama,4)
label(returnhere)
label(originalcode)
label(exit)

mama:
 dd 0

newmem:
cmp [mama],0
je originalcode
mov eax,[mama]

originalcode:
mov [esi+18],eax
mov eax,[edi+1C]

exit:
jmp returnhere

"Asphalt8.exe"+870F3:
jmp newmem
nop
returnhere:
registersymbol(mama)


 
 
[DISABLE]
unregistersymbol(mama)
dealloc(newmem)
dealloc(mama)
"Asphalt8.exe"+870F3:
mov [esi+18],eax
mov eax,[edi+1C]

Re: Where Can I find tutorial about making an EDIT BOX to Code Injection?

Posted: Wed Jan 10, 2018 11:23 am
by Acido
marek1957 wrote:
Wed Jan 10, 2018 12:14 am
hey Acido! Thank you for your help! It is working perfectly!!!!

I was trying to do the same with number of LAPS but when I freeze the script - I am instantly ending the race! Then when I unfreeze the script and do again the race, I will have a number of laps that I wrote. Why is that happening?
Glad its working for you, as for your question on the other script, you're jumping over the original code to exit after the compare, jump to originalcode instead of exit, plus it looks like from your posted code that the value should go into esi+18 not esi+1C. Also you can't use the same code exactly cause eax will have your value in this function and you're overwriting it. You can use another register or use the code suggested by Blayde above, though you shouldn't need to allocate 4 bytes for it as he's doing, just registering it as a symbol is fine. It is already allocated in newmem.

Re: Where Can I find tutorial about making an EDIT BOX to Code Injection?

Posted: Wed Jan 10, 2018 6:59 pm
by sbryzl
Acido wrote:
Wed Jan 10, 2018 11:23 am
. You can use another register or use the code suggested by Blayde above, though you shouldn't need to allocate 4 bytes for it as he's doing, just registering it as a symbol is fine. It is already allocated in newmem.
It's not allocated under newmem in Blayde's script.

Re: Where Can I find tutorial about making an EDIT BOX to Code Injection?

Posted: Wed Jan 10, 2018 8:46 pm
by Acido
sbryzl wrote:
Wed Jan 10, 2018 6:59 pm
Acido wrote:
Wed Jan 10, 2018 11:23 am
. You can use another register or use the code suggested by Blayde above, though you shouldn't need to allocate 4 bytes for it as he's doing, just registering it as a symbol is fine. It is already allocated in newmem.
It's not allocated under newmem in Blayde's script.
No but that is why i said just register it as a symbol and it will already be allocated under newmem. But at the end of the day doesn't really matter.

Re: Where Can I find tutorial about making an EDIT BOX to Code Injection?

Posted: Wed Jan 10, 2018 9:05 pm
by sbryzl
Acido wrote:
Wed Jan 10, 2018 8:46 pm
sbryzl wrote:
Wed Jan 10, 2018 6:59 pm
Acido wrote:
Wed Jan 10, 2018 11:23 am
. You can use another register or use the code suggested by Blayde above, though you shouldn't need to allocate 4 bytes for it as he's doing, just registering it as a symbol is fine. It is already allocated in newmem.
It's not allocated under newmem in Blayde's script.
No but that is why i said just register it as a symbol and it will already be allocated under newmem. But at the end of the day doesn't really matter.
Just registering it as a symbol will not place it under newmem. You have to place that label under the newmem label in the script in order to locate it within newmem along with allocation designation.

Re: Where Can I find tutorial about making an EDIT BOX to Code Injection?

Posted: Wed Jan 10, 2018 11:25 pm
by Acido
sbryzl wrote:
Wed Jan 10, 2018 9:05 pm
Acido wrote:
Wed Jan 10, 2018 8:46 pm
sbryzl wrote:
Wed Jan 10, 2018 6:59 pm

It's not allocated under newmem in Blayde's script.
No but that is why i said just register it as a symbol and it will already be allocated under newmem. But at the end of the day doesn't really matter.
Just registering it as a symbol will not place it under newmem. You have to place that label under the newmem label in the script in order to locate it within newmem along with allocation designation.
Obviously and it was.

I'm not sure what point you're trying to make? the script as posted was correct, whatever you wanna allocate additional memory from another region or reuse what is already allocated is up to you of course. For me personally i don't really like to do extra allocations when they are not needed, but it will work just the same whatever you do it 1 way or the other.