Open Eyoko1 opened 10 months ago
Hey @Eyoko1
This should all be doable from Javascript using the modifyMemory
function of Cetus. Here's an example of searching and modifying memory using the Javascript console. This will find all values of type i32
matching 1000 and replace them with the value 2000
.
const searchResults = cetus.search("eq", "i32", true, 1000);
const resultAddresses = Object.keys(searchResults.results);
for (const address of resultAddresses) {
cetus.modifyMemory(address, 2000, "i32");
}
If you're using the latest git version, it's a little bit different (Because Cetus can now support multiple WASM binaries at once). The same example would look something like this:
const instance = cetusInstances.get(0);
const searchResults = instance.search("eq", "i32", true, 1000);
const resultAddresses = Object.keys(searchResults.results);
for (const address of resultAddresses) {
instance.modifyMemory(address, 2000, "i32");
}
Jack
I am on the latest version and neither 'cetus' nor 'cetusInstances' are defined
Is the browser console in the correct context? On chrome you're looking for a button like this.
If the extension is unlocked, then one of those variables must be defined.
Thank you that worked, I have to have the context in the pages html, but every time I load the page I have to manually find the html context and set it, is there a better way to do this?
Good question @Eyoko1 , this is one of my biggest annoyances too. I'm frankly not sure what the right fix would be, but I'm gonna add this as a possible improvement.
After finding the coins for example how can you change it using javascript? I haven't found anything about how to do this and there isn't a feature in cetus to do it