|
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
LtO Advanced Cheater Reputation: 0
Joined: 09 Mar 2015 Posts: 71
|
Posted: Wed Feb 07, 2018 9:23 am Post subject: Changing big strings in flash game? |
|
|
I have some trouble changing a few big strings in the memory of a flash game... It seemed pretty simple at first and when I changed the values it actually worked, however cuz of the size of all the text and some strings that are identical to others being used by another map makes it harder.
Those are maps in the game and it shows the rows in it which have either 0 as value if there is no block and 1 or another number for if a block is there (numbers define the color). For example:
<mapList>
<map>
<type>No Maps</type>
<packId>8060</packId>
<id>1</id>
<name>No Maps</name>
<desc>No Maps</desc>
<funnyDesc>So much of life, it seems to me, is determined by pure randomness. - Sidney Poitier</funnyDesc>
<mapData>
<node row="0,0,0,0,0,0,0,0,0,0"/>
<node row="0,0,0,0,0,0,0,0,0,0"/>
<node row="0,0,0,0,0,0,3,0,0,0"/>
<node row="3,3,3,3,0,0,0,3,3,3"/>
<node row="3,3,3,3,3,0,3,3,3,3"/>
<node row="1,5,2,3,0,0,3,3,3,3"/>
<node row="3,3,3,3,0,0,0,3,3,3"/>
<node row="3,3,3,3,3,0,3,3,3,3"/>
<node row="1,5,2,3,0,0,3,3,3,3"/>
<node row="3,3,3,3,0,0,0,3,3,3"/>
<node row="3,3,3,3,3,0,3,3,3,3"/>
<node row="1,5,2,3,0,0,3,3,3,3"/>
<node row="3,3,3,3,0,0,0,3,3,3"/>
<node row="3,3,3,3,3,0,3,3,3,3"/>
<node row="1,5,2,3,0,0,3,3,3,3"/>
<node row="3,3,3,3,0,0,0,3,3,3"/>
<node row="3,3,3,3,3,0,3,3,3,3"/>
<node row="1,5,2,3,0,0,3,3,3,3"/>
<node row="3,3,3,3,0,0,0,3,3,3"/>
<node row="3,3,3,3,3,0,3,3,3,3"/>
</mapData>
</map>
The problem is when I search for such a node string, I can easily find and replace it, but then it replaces all those strings, some that are also used in other maps... Also I'm not sure how I could search for and change such big string values like this... I've tried with an asterisk * to search for those rows despite the numbers in it but that doesn't work (like <node row="1,5,2,3,0,0,*,*,*,3"/> for example). So all I really want to do is change every map to my own, and all of them can be the same... No id's or anything should be changed... I also saw in the code that it uses some spaces and dots in between values/strings, so I'm not sure how to search for big strings like this. Help would be appreciated a lot!
So I think I need a little script that searches for all those maps, and changes them (the node rows) with my own...
|
|
Back to top |
|
|
TheyCallMeTim13 Wiki Contributor Reputation: 50
Joined: 24 Feb 2017 Posts: 976 Location: Pluto
|
Posted: Wed Feb 07, 2018 9:37 am Post subject: |
|
|
Is this a file, a string in memory, or some thing else? What do you have so far to parse this? Are you using XML parsing or just searching for a string?
_________________
|
|
Back to top |
|
|
LtO Advanced Cheater Reputation: 0
Joined: 09 Mar 2015 Posts: 71
|
Posted: Wed Feb 07, 2018 10:00 am Post subject: |
|
|
TheyCallMeTim13 wrote: | Is this a file, a string in memory, or some thing else? What do you have so far to parse this? Are you using XML parsing or just searching for a string? |
Oh, it comes from an xml file yes, where the info like I posted already is in... The flash game loads that xml file and it is stored in memory as you can find it. I have to say the xml file itself is encrypted by now, but I don't think that makes a difference (I used to edit it there with my webdebugger)... Here is how it looks in memory, in attachment.
Thanks
Description: |
|
Filesize: |
80.89 KB |
Viewed: |
5776 Time(s) |
|
|
|
Back to top |
|
|
TheyCallMeTim13 Wiki Contributor Reputation: 50
Joined: 24 Feb 2017 Posts: 976 Location: Pluto
|
Posted: Wed Feb 07, 2018 12:18 pm Post subject: |
|
|
With what you what to change, you could go with an AOB scan to find the right Starting points. Then either replace bytes based on offsets, or read it as a string and parse the XML, there are some modules that can help with this. But you will need to check and see if the string has a 00 byte and some space at the end, because if some thing else is packed it right after the string a change in size will probably not work out.
EDIT:
But if the file exists of your file system then I would look at editing that.
_________________
|
|
Back to top |
|
|
LtO Advanced Cheater Reputation: 0
Joined: 09 Mar 2015 Posts: 71
|
Posted: Wed Feb 07, 2018 1:47 pm Post subject: |
|
|
TheyCallMeTim13 wrote: | With what you what to change, you could go with an AOB scan to find the right Starting points. Then either replace bytes based on offsets, or read it as a string and parse the XML, there are some modules that can help with this. But you will need to check and see if the string has a 00 byte and some space at the end, because if some thing else is packed it right after the string a change in size will probably not work out.
EDIT:
But if the file exists of your file system then I would look at editing that. |
Thanks, I can find the string as array of bytes too, but also just 1 node row... But I wonder how could I find this info in memory completely, or is that not possible? Like string after string... So that I can replace it map per map which is what I would like to do... Is there a way to do that?
|
|
Back to top |
|
|
TheyCallMeTim13 Wiki Contributor Reputation: 50
Joined: 24 Feb 2017 Posts: 976 Location: Pluto
|
Posted: Wed Feb 07, 2018 5:35 pm Post subject: |
|
|
To read the file you should be able to just read the string with readString, it looks to me like it's just each line and I bet it's just a null ended string, but as I said before the sting may not have room to get any bigger/longer.
As for finding it just convert the string to bytes and add wild card as needed "20 20 20 3C 6E 6F 64 65 20 72 6F 77 3D 22 30 2C 30 ** 30 ** 30 ** 30 22 2F 3E 0D 0A", the image you posted has the strings bytes on the left and the string on the right.
_________________
|
|
Back to top |
|
|
Corroder Grandmaster Cheater Supreme Reputation: 75
Joined: 10 Apr 2015 Posts: 1667
|
Posted: Thu Feb 08, 2018 5:14 am Post subject: |
|
|
@LtO. If I not misunderstood, here a sample to parsing and change value on node row, basic from your xml script :
Assuming your xml as : MyTest.xml (could be an URL where is xml stored)
Code: | <mapList>
<map>
<type>No Maps</type>
<packId>8060</packId>
<id>1</id>
<name>No Maps</name>
<desc>No Maps</desc>
<funnyDesc>So much of life, it seems to me, is determined by pure randomness. - Sidney Poitier</funnyDesc>
<mapData>
<node row="0,0,0,0,0,0,0,0,0,0"/>
<node row="0,0,0,0,0,0,0,0,0,0"/>
<node row="0,0,0,0,0,0,3,0,0,0"/>
<node row="3,3,3,3,0,0,0,3,3,3"/>
<node row="3,3,3,3,3,0,3,3,3,3"/>
<node row="1,5,2,3,0,0,3,3,3,3"/>
<node row="3,3,3,3,0,0,0,3,3,3"/>
<node row="3,3,3,3,3,0,3,3,3,3"/>
<node row="1,5,2,3,0,0,3,3,3,3"/>
<node row="3,3,3,3,0,0,0,3,3,3"/>
<node row="3,3,3,3,3,0,3,3,3,3"/>
<node row="1,5,2,3,0,0,3,3,3,3"/>
<node row="3,3,3,3,0,0,0,3,3,3"/>
<node row="3,3,3,3,3,0,3,3,3,3"/>
<node row="1,5,2,3,0,0,3,3,3,3"/>
<node row="3,3,3,3,0,0,0,3,3,3"/>
<node row="3,3,3,3,3,0,3,3,3,3"/>
<node row="1,5,2,3,0,0,3,3,3,3"/>
<node row="3,3,3,3,0,0,0,3,3,3"/>
<node row="3,3,3,3,3,0,3,3,3,3"/>
</mapData>
</map>
|
to parsing and chage in lua without use any special lua libraries, eq luaXML, luaNode, etc.
Code: | local file = assert(io.open("MyTest.xml"))
local xml = file:read"*a"
file:close()
xml = xml:gsub("<map>.-</map>",
function(s)
local type = s:match"<type>(.-)</type>"
local packId = s:match"<packId>(.-)</packId>"
local id = s:match"<id>(.-)</id>"
local name = s:match"<name>(.-)</name>"
if
type == "No Maps" and
packId == "8060" and
id == "1" and
name == "No Maps"
then
return s:gsub("<mapData>.-</mapData>",
function(s)
return s:gsub('<node row="0,0,0,0,0,0,0,0,0,0"/>',
'<node row="1,5,2,3,0,0,3,3,3,3"/>') ---- replacing node row value
end
)
end
end
)
local file = assert(io.open(""MyTest2.xml", "w")) --- or write to "MyTest.xml" to over ride file contents
-- print(xml) --- print results
file:write(xml)
file:close()
---- output :
<mapList>
<map>
<type>No Maps</type>
<packId>8060</packId>
<id>1</id>
<name>No Maps</name>
<desc>No Maps</desc>
<funnyDesc>So much of life, it seems to me, is determined by pure randomness. - Sidney Poitier</funnyDesc>
<mapData>
<node row="1,5,2,3,0,0,3,3,3,3"/>
<node row="1,5,2,3,0,0,3,3,3,3"/>
<node row="0,0,0,0,0,0,3,0,0,0"/>
<node row="3,3,3,3,0,0,0,3,3,3"/>
<node row="3,3,3,3,3,0,3,3,3,3"/>
<node row="1,5,2,3,0,0,3,3,3,3"/>
<node row="3,3,3,3,0,0,0,3,3,3"/>
<node row="3,3,3,3,3,0,3,3,3,3"/>
<node row="1,5,2,3,0,0,3,3,3,3"/>
<node row="3,3,3,3,0,0,0,3,3,3"/>
<node row="3,3,3,3,3,0,3,3,3,3"/>
<node row="1,5,2,3,0,0,3,3,3,3"/>
<node row="3,3,3,3,0,0,0,3,3,3"/>
<node row="3,3,3,3,3,0,3,3,3,3"/>
<node row="1,5,2,3,0,0,3,3,3,3"/>
<node row="3,3,3,3,0,0,0,3,3,3"/>
<node row="3,3,3,3,3,0,3,3,3,3"/>
<node row="1,5,2,3,0,0,3,3,3,3"/>
<node row="3,3,3,3,0,0,0,3,3,3"/>
<node row="3,3,3,3,3,0,3,3,3,3"/>
</mapData>
</map>
|
or you can use XML DOM, visit here : https://www.w3schools.com/xml/dom_nodes_set.asp
_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL |
|
Back to top |
|
|
LtO Advanced Cheater Reputation: 0
Joined: 09 Mar 2015 Posts: 71
|
Posted: Thu Feb 15, 2018 4:23 am Post subject: |
|
|
Thanks! What I did is I looked in the memory how the maps are stored, and then created/summed the code in array of bytes, and it found it then the full map, however when I changed it with my modified map it failed for some reason (changed a few of those maps).
I succeeded to use an alternative then, with using wildcards and changing all rows it finds, to create a more simplified version of what I wanted but it does the job
Now I'd just like to know, is there something I could do that the code doesn't fuck up when the string comes a little bigger? I would like to change a few of those numbers, 3 for example into 13 (different color), but that doesn't work, probably because the space for that extra code didn't exist?
|
|
Back to top |
|
|
|
|
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
|
|