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 


Need help to find function that writes a string

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
soggytoast111
Cheater
Reputation: 0

Joined: 25 Sep 2020
Posts: 26

PostPosted: Fri Sep 25, 2020 12:37 pm    Post subject: Need help to find function that writes a string Reply with quote

Hello, I'm working on a hacking project but kind of stuck at this point.

There's a specific string that's written somewhere in memory and I want to find where in the code this is generated so I can see how this function works. This is a random string that is generated at the time the function is called, so it doesn't exist anywhere in memory until then.

I can find the string easily after it's written, but it doesn't always go into memory in the same place so I can't just use the "find out what writes to this address" option.

I've been trying to use breakpoints and step through the disassembler to figure out when it's written, but this is tedious and I'm not sure if I'm guaranteed to find it this way.

Is there an easier way to do this? Or maybe set up some kind of LUA script to make this work less time consuming at least?
Back to top
View user's profile Send private message
Csimbi
I post too much
Reputation: 97

Joined: 14 Jul 2007
Posts: 3325

PostPosted: Sat Sep 26, 2020 5:59 am    Post subject: Reply with quote

Ultimap?
Back to top
View user's profile Send private message
soggytoast111
Cheater
Reputation: 0

Joined: 25 Sep 2020
Posts: 26

PostPosted: Sat Sep 26, 2020 10:10 am    Post subject: Reply with quote

I don't really have any experience with ultimap. How do I use ultimap to help find this?
Back to top
View user's profile Send private message
DanyDollaro
Master Cheater
Reputation: 3

Joined: 01 Aug 2019
Posts: 334

PostPosted: Sat Sep 26, 2020 4:30 pm    Post subject: Reply with quote

The fact that you can easily find the string makes me assume that it is shown on the screen or that it is part of a data structure you have access to, you may find out which code reads the characters of that string and see in which register its address is loaded, from there doing a bit of reverse engineering you could discover where the function gets the information on the new position of the string and from there you can find information about the function that writes it, since the strings are passed as parameters by reference, the function that generates the string will overwrite the pointer that will use the function that acts in reading, doing it requires skill and time and consider that there is the possibility that the string will be read only a limited number of times, in that case I would only think of the use of Multimap as suggested by Csimbi.
Back to top
View user's profile Send private message
soggytoast111
Cheater
Reputation: 0

Joined: 25 Sep 2020
Posts: 26

PostPosted: Sun Sep 27, 2020 10:40 am    Post subject: Reply with quote

Quote:
The fact that you can easily find the string makes me assume that it is shown on the screen or that it is part of a data structure you have access to


Hmmm... not exactly. The string is used to authenticate users who log in to servers with the game client. A string is generated one time as the user presses the login button - I assume it's based on mixing together some data about username and some other variables. My goal here is to figure out how that string is generated so that I can forge my own and "log in" without the game client.

I can only find the string consistently because parts of it do not change so I can search that part of the string.

Quote:
you may find out which code reads the characters of that string and see in which register its address is loaded, from there doing a bit of reverse engineering you could discover where the function gets the information on the new position of the string and from there you can find information about the function that writes it, since the strings are passed as parameters by reference, the function that generates the string will overwrite the pointer that will use the function that acts in reading,


Could you explain more about this method? I don't quite follow.

So you're saying I can find the string, figure out what reads the string, and then somehow backtrace to the function that created it because the one reading it must reference it somehow?

Can you link to an example or something to help me understand this?

Quote:
in that case I would only think of the use of Multimap as suggested by Csimbi.


I can't get DVBM/Ultimap to work unfortunately. It seems like it's detected by the game. Cheat engine works fine with the driver unloaded, but the game crashes/refuses to boot with DVBM.

Any tips on getting around this check?
Back to top
View user's profile Send private message
DanyDollaro
Master Cheater
Reputation: 3

Joined: 01 Aug 2019
Posts: 334

PostPosted: Sun Sep 27, 2020 12:29 pm    Post subject: Reply with quote

I haven't links to share, they are my general notions of programming.
Usually when you write a function that has to receive a string as a parameter you pass it by reference, in low-level programming languages such as C or C++ this operation must be explicit, while in high-level languages such as Javascript or Python they are passed by default for reference.

The easiest way is to search with the Cheat Engine's memory scanner for the address of the string and if you find variables like "pointer to a pointer to a string" pointing to your string you can see what it writes to that address and you may find the function that generates it.
In case that doesn't happen then the string is handled differently, then you could find any function that reads the string and enumerate its parameters and find out which of those the function uses to find the string, most likely it will use a pointer, if so then you can go to the first method I have listed for you, I was just about to forget to tell you that to "enumerate its parameters" you could just take a look at the stack as soon as the thread breaks into the entry point of the function.
In case you still haven't understood you should deepen your knowledge on assembly, on the other hand I should describe you an infinite number of cases that could happen and would never end.
Back to top
View user's profile Send private message
soggytoast111
Cheater
Reputation: 0

Joined: 25 Sep 2020
Posts: 26

PostPosted: Sun Sep 27, 2020 1:26 pm    Post subject: Reply with quote

Thanks that's a lot to chew on, but I think this at least gives me a few more angles to try. I'm very new to assembly (this is really my first project) but I do have some experience with Javascript/Python. I'm learning fast though - happy that I already got this far.

I found some cool info on some ways to bypass Cheat Engine/debugger anticheat detection so maybe ultimap isn't a complete lost cause either. Ultimap seems like a much easier way to accomplish this.
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 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