Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Working on Str functions #11

Closed
cecio opened this issue Aug 18, 2020 · 10 comments
Closed

Working on Str functions #11

cecio opened this issue Aug 18, 2020 · 10 comments

Comments

@cecio
Copy link
Contributor

cecio commented Aug 18, 2020

Hello!

First of all thanks for the great tool!

If you are interested, and if you are not doing it by yourself, I'm working on the string search functions.
I have a working prototype, but still WIP.

If you want we can discuss a bit on how you prefer to implement it: I started with my way, but may be it make sense to double check with you if it make sense at all :-)

Thanks,

@Qwokka
Copy link
Owner

Qwokka commented Aug 19, 2020

Hey @cecio,

Thanks for doing all this. I like the changes you've made.

One thing I might note though is that Cetus is gonna get a pretty major UI overhaul in the coming weeks (It's actually be in the works for a while). So some of your changes might get reworked with that.

Do you mind turning your branch into a pull request?

Jack

@cecio
Copy link
Contributor Author

cecio commented Aug 19, 2020

Hey!

Sure, I will make a pull request. Before doing it, I need to fix some things, and also I'd like to add some additional "search":

  • search a specific string (not sure if it make sense, but it will be preparatory for the next one)
  • search a specific byte sequence

Then I have also a couple of other things in mind, which will be part of a second "batch" (I was thinking about the memory browser you mentioned in another issue and a kind of "XOR search" like the xorsearch utility). Especially for the first one, may be it's better to wait the UI rework anyway.

Thanks!!

@cecio
Copy link
Contributor Author

cecio commented Aug 19, 2020

I pushed another version on my fork.
I changed a bit my mind during the review of the current logic of searches:

  • I added 4 buttons: Numeric, StrAscii, StrUnicode and Byte Sequence.

I did this mainly for the following reasons:

  • I kept the two search (unicode and ascii) separated, since the results should be treated differently by a watch (different memory alignment)
  • right now I didn't added the search of a specific string, mainly because I didn't want to clutter the interface (I did it enough) and also because it can be done with the "Byte Sequence" search
  • I'm implementing now the byte sequence search (there is only the button, still WIP).

Let me know if this sound reasonable, or if you prefer a different approach.

Thanks! :-)

@cecio
Copy link
Contributor Author

cecio commented Aug 20, 2020

OK, I completed also the "Byte sequence" search...needs a bit of testing, but it looks more or less working.

If you want to have a look...then let me know if you prefer I re-work something.

Then I can make a pull request.

Thanks,

@Qwokka
Copy link
Owner

Qwokka commented Aug 23, 2020

This is all committed now. I changed the UI just a bit so that you can do searches for specific string/byte values from the "Search" tab and do full dumps of strings from the new "Strings" tab.

I also appreciate you taking the time to put in all the debugging info, it's a lot of help!

I'll close this issue since I think everything here is covered, but thanks again!

@Qwokka Qwokka closed this as completed Aug 23, 2020
@cecio
Copy link
Contributor Author

cecio commented Aug 23, 2020

Thanks to you!

@Alissonerdx
Copy link

is it possible to change the strings?

@Qwokka
Copy link
Owner

Qwokka commented Dec 20, 2021

Hi @Alissonerdx

There's nothing in the GUI that will let you modify strings, but you can do this with a little bit of Javascript. Here's a little example function that will write an ASCII string to an address.

function writeString(address, strVal) {
    for(var i = 0; i < strVal.length; i++) {
        var thisChar = strVal.charCodeAt(i);
        cetus.modifyMemory(address + i, thisChar & 0xFF, "i8");
    }
}

Keep in mind though that if you attempt overwrite a string with a larger string, you may overwrite other values in memory. This would have unpredictable results. Hope it helps anyway, good luck!

@Alissonerdx
Copy link

Alissonerdx commented Dec 20, 2021

@Qwokka So I managed to change it directly by taking the address that was found in cetus and then going straight to the unity heap, thanks for the reply. Here's the simple code I made similar to yours.

function(memoryWalletsBeginPositions, newWallet) {
        let arrayNewWallet = window.uft8ToDecimals(newWallet);
        memoryWalletsBeginPositions.forEach((value, index) => {
            for(var i = 0; i < newWallet.length; i++)
            {
                window.unityInstance.Module.HEAPU8[value + i] = arrayNewWallet[i];
            }
        });
    }

@Qwokka
Copy link
Owner

Qwokka commented Dec 20, 2021

Glad you got it working, thanks for sharing you code!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants