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 


How to auto attach, search, modify, and execute script?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
AbrasiveZealot
Newbie cheater
Reputation: 0

Joined: 02 Jan 2011
Posts: 21

PostPosted: Fri Jun 15, 2012 7:11 pm    Post subject: How to auto attach, search, modify, and execute script? Reply with quote

Hello,
Fairly recently I found an exploit that allows players to use any modified material file in the new (2007+) source engine (for games that use .vpk archives to pack materials), which allows a wide array of undetectable texture hacks, or "mathacks". The only problem with it, is that it involves renaming files, then patching the games memory, and then renaming files again. While this doesn't take very long to do manually, having to do it every time you launch the game get's very tedious, and accidentally forgetting a step can cause a VAC ban and a game crash. I have successfully made a batch file in windows that automates the process of renaming the files, and I'm wondering if it's possible to make a trainer that automates the process of patching the game memory.

All it really needs to be able to do is automatically attach to the correct process, search for an array of bytes, and then modify the result (there's always only one). It would be great if it's possible to get it to automatically run the script once opened, so that it's not necessary to push a button or anything. But if it's not possible then that's alright.

Also, on a somewhat related note; If it is possible to get it to automatically execute the script, would it be able to automatically close as well? Once the memory is patched there's no need to keep it open, you don't have to freeze it or anything. That way my batch file + trainer could be completely automatic and not require input from the user (other then launching the game and waiting for the menu to load).

EDIT:: If i wasn't being specific enough, I need to make a script that will...

Search the memory for:
[insert hexadecimal bytes]

And change the only result to:
[insert hexadecimal bytes]

But, it needs to not have a [disable] section. I would like to be able to close the trainer/cheat engine without it getting disabled.

And preferably...
Be able to automatically execute the patch, so i can run it from a batch file.
And close automatically once the patch has been made.
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

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

PostPosted: Sat Jun 16, 2012 7:12 am    Post subject: Reply with quote

you could do a lua script
strings_add(getAutoAttachList(),"processname")

function onOpenProcess()
autoAssemble([[script]])
closeCE()
end

where script is a simple aobscan replace script
you can of course do an aobscan in lua as well, but it's more complex and only intended if there is more than one result

_________________
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
AbrasiveZealot
Newbie cheater
Reputation: 0

Joined: 02 Jan 2011
Posts: 21

PostPosted: Sat Jun 16, 2012 1:15 pm    Post subject: Reply with quote

While I really have no preference about it using lua or assembler as long as it works, I have a bit more experience with lua so it's easier for me to undersand.
After doing a bit of research I've found a thread ("auto search & first address add table?") and have some questions about it.

Since only one address is returned, does it still have to be added to the address list to be modified? And if it does, will the address list function still work properly without the cheat engine gui?

Searching through the help file, i was only able to find two things regarding changing or modifying a value; writeBytes and addresslist_doValueChange. Because i would like this to not require input i don't think addresslist_doValueChange will work so that leaves writeBytes. In the help file it says it's use is to change the value of a specific address, but the address isn't static so i cant see how this would do it.

Am i just missing something? I haven't been able to find much of anything about changing the result, and nothing at all about how to do something like this with the assembler.

This is what i have so far:
Code:

strings_add(getAutoAttachList(),"processname")

function onOpenProcess()
ms=createMemScan()
memscan_firstScan(ms, soExactValue, vtByteArray, rtRounded, "test1", "0", 0x00000000, 0x10000000, "", fsmNotAligned, "", false, false, true, false)
memscan_waitTillDone(ms)
fl=createFoundList(ms)
foundlist_initialize(fl)
local count=foundlist_getCount(fl)
if (count>0) then
  local saddress=foundlist_getAddress(fl, 0)
  local al=getAddressList()
  local mr=addresslist_createMemoryRecord(al)
  end
closeCE()
end


I understand you not wanting to just give me the answer, trust me. I'm a Moderator on another cheating site, and I just point people in the right direction and make them do they're own research. I've been working on this for a while and haven't been able to come up with a solution, so every bit of knowledge helps. Thanks!
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

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

PostPosted: Sat Jun 16, 2012 3:26 pm    Post subject: Reply with quote

auto assemble script that finds and replace the first occurance :
Code:

aobscan(bla, 11 22 33 44 55)
bla:
db 90 90 90 90 90


anyhow, if you insist on 100% lua, I recommend looking into aobscan
Code:

results=AOBScan('11 22 33 44 55')
if strings_getCount(results)>0 then
  --get first entry
  address=strings_getText(results,0)
  fullAccess(address) --makes it writable
  writeBytes(address, 0x90,0x90,0x90,0x90,0x90)
end

_________________
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
AbrasiveZealot
Newbie cheater
Reputation: 0

Joined: 02 Jan 2011
Posts: 21

PostPosted: Sat Jun 16, 2012 4:11 pm    Post subject: Reply with quote

This is what i used, it works great:
Code:
strings_add(getAutoAttachList(),"process.exe")

function onOpenProcess()
autoAssemble([[aobscan(bla, ** ** ** ** **)
bla:
db ** ** ** ** **]])
end


I have opted out of the auto close feature, this way the support banner will be able to be read.

Thanks Dark Byte! You da best!
Back to top
View user's profile Send private message
jaguarvn
How do I cheat?
Reputation: 0

Joined: 27 Jul 2012
Posts: 1

PostPosted: Sun Jul 29, 2012 6:19 am    Post subject: Reply with quote

I usually scan value : 22939420328016 (exact value, 8bytes)
and change it to 214748364800350

Please have me how to do it automatic.
Thank you
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