Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Code Injection in multiple addresses

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
Fixxxer
How do I cheat?
Reputation: 0

Joined: 29 Apr 2013
Posts: 7

PostPosted: Fri Oct 04, 2013 8:08 am    Post subject: Code Injection in multiple addresses Reply with quote

Hello,

I need to make code injection in 3 spots at the same time.

For example I want to search for code "AA CC DD DD" and have the same code injection in all addresses (it returns more than 1 results),
the code injection would be something like
mov [eax+40],eax
mov eax,[ecx+50]
mov eax,[ecx+60]

I have managed to do this for one spot using autoassemble and aobscan, but I cannot make it work within a lua script using the aobscan, I get a bit confused

Thanks in advance
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

Joined: 09 May 2003
Posts: 25287
Location: The netherlands

PostPosted: Fri Oct 04, 2013 8:37 am    Post subject: Reply with quote

A script like this will do that:
Code:

result=AOBScan("AA CC DD DD");
for i=0,result.Count-1 do
  autoAssemble(string.format([[
    %s:
      mov [eax+40],eax
      mov eax,[ecx+50]
      mov eax,[ecx+60]
  ]],result[i]));
end
result.destroy()
result=nil


AOBScan will return a Stringlist object
string.format('',result[#]) will replace %s with the string stored in result at line #

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
Fixxxer
How do I cheat?
Reputation: 0

Joined: 29 Apr 2013
Posts: 7

PostPosted: Fri Oct 04, 2013 8:54 am    Post subject: Reply with quote

Thanks alot. That looks easy. Is there any reference/documentation or something regarding the autoAssemble format?
I really like to understand what I am doing and at this point even though I know it will work I get confused with what is the role/purpose of the "[" .

I would also like to add something to this script.
For example i want to find address "1F 2C" and set the [eax+40] to the address value (+offset = 10). To make it easier I assume there is only one address.

something like this would work?

Code:
result1= AOBScan("1F 2C");             // <---my noob code here :)
result=AOBScan("AA CC DD DD");
for i=0,result.Count-1 do
  autoAssemble(string.format([[
    %s:
      mov [eax+40],string.format(result1[0]+10) // <---my noob code here :)
//      mov [eax+40],eax
      mov eax,[ecx+50]
      mov eax,[ecx+60]
  ]],result[i]));
end
result.destroy()
result=nil
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

Joined: 09 May 2003
Posts: 25287
Location: The netherlands

PostPosted: Fri Oct 04, 2013 11:06 am    Post subject: Reply with quote

[[ ]] means it's a string. (Multiline string)

to do what you wish you'd do:
Code:

result1= AOBScan("1F 2C");
result=AOBScan("AA CC DD DD");
for i=0,result.Count-1 do
  autoAssemble(string.format([[
    %s:
      mov [eax+40],%s+10
      mov eax,[ecx+50]
      mov eax,[ecx+60]
  ]],result[i],result1[0]));
end
result.destroy()
result=nil

result1.destroy()
result1=nil

the second %s gets replaced by the string in result1

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
Fixxxer
How do I cheat?
Reputation: 0

Joined: 29 Apr 2013
Posts: 7

PostPosted: Fri Oct 04, 2013 11:27 am    Post subject: Reply with quote

Thanks very much once again
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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 can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites