#๐Ÿ”’ Pointers and poking memory for processes for a game mod

11 messages ยท Page 1 of 1 (latest)

supple pivot
#

i play this unity game, gearblocks, and im trying to mod python scripting into the game
i want to have a python process hook into the game in a similar way like this C++ win32 code

uintptr_t FindPatternIDA(const char* szSignature)
    {
        MODULEINFO modInfo;
        GetModuleInformation(GetCurrentProcess(), GetModuleHandleA(NULL), &modInfo, sizeof(MODULEINFO));
        uintptr_t startAddress = (uintptr_t)GetModuleHandleA(NULL);
        uintptr_t endAddress = (startAddress + (uintptr_t)modInfo.SizeOfImage);
        const char* pat = szSignature;
        uintptr_t firstMatch = 0;
        for (uintptr_t pCur = startAddress; pCur < endAddress; pCur++) {
            if (!*pat) return firstMatch;
            if (*(PBYTE)pat == ('\?') || *(BYTE*)pCur == get_byte(pat)) {
                if (!firstMatch) firstMatch = pCur;
                if (!pat[2]) return firstMatch;
                if (*(PWORD)pat == ('\?\?') || *(PBYTE)pat != ('\?')) pat += 3;
                else pat += 2;
            }
            else {
                pat = szSignature;
                firstMatch = 0;
            }
        }
        printf("[Error] Unable to find memory pattern!\n");
        return NULL;
    }

is there some way for me to probe memory and obtain pointers in python like you can in c?

gentle marshBOT
#

@supple pivot

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

bitter ridge
#

is there some way for me to probe memory and obtain pointers in python like you can in c?
There is not @supple pivot

supple pivot
#

okay

#

thanks

#

i think my best bet will be to run a webserver locally for an api

bitter ridge
#

I guess you could look into how programs like the PyCharm debugger access interpreter state

supple pivot
#

i dont really want to probe around in memory, and i should hopefully be able to invoke the game's moonsharp lua from the bepinex c# environment and if i can spin up a simple webserver i should be able to allow any program to hook into it

gentle marshBOT
#

:warning: The owner of this post is no longer in the server.

gentle marshBOT
#
Python help channel closed for inactivity

This help channel has been closed. Feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.