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

Auto assembler like in Cheat Engine #232

Open
DotMatrixMoe opened this issue Dec 30, 2023 · 5 comments
Open

Auto assembler like in Cheat Engine #232

DotMatrixMoe opened this issue Dec 30, 2023 · 5 comments

Comments

@DotMatrixMoe
Copy link

I was wondering if there could be (or already is an) auto assembler in PINCE. I'd like to search big-endian floats in RPCS3 using scripts like this:

alloc(TypeName,256)
alloc(ByteSize,4)
alloc(ConvertRoutine,1024)
alloc(ConvertBackRoutine,1024)
alloc(UsesFloat,4)

TypeName:
db 'Float Big Endian',0
ByteSize:
dd 4
UsesFloat:
db 01

ConvertRoutine:
[32-bit]
push ebp
mov ebp,esp
mov eax,[ebp+8] //place the address that contains the bytes into eax
mov eax,[eax]   //place the bytes into eax
bswap eax
pop ebp
ret 4
[/32-bit]

[64-bit]
//rcx=address of input
mov eax,[rcx] //eax now contains the bytes 'input' pointed to
bswap eax
ret
[/64-bit]

ConvertBackRoutine:
[32-bit]
push ebp
mov ebp,esp
//[ebp+8]=input
//[ebp+c]=address of output
push eax
push ebx
mov eax,[ebp+8] //load the value into eax
mov ebx,[ebp+c] //load the address into ebx
bswap eax
mov [ebx],eax //write the value into the address
pop ebx
pop eax

pop ebp
ret 8
[/32-bit]

[64-bit]
//ecx=input
//rdx=address of output
bswap ecx
mov [rdx],ecx //place the integer the 4 bytes pointed to by rdx
ret
[/64-bit]
@korcankaraokcu
Copy link
Owner

korcankaraokcu commented Dec 30, 2023

It's in the roadmap. Scripting and assembler are already available but they are not integrated into GUI yet. Libpince engine is the scripting support and it actually is the next step in the roadmap so this feature will be most likely implemented within next year. I'll update this issue once it's complete. Here's the roadmap if you are interested

Edit: To clarify, you can already inject single-line asm by right clicking on the disassemble window but not trampoline code, that's what I meant when I said "not integrated into GUI yet"

@DotMatrixMoe
Copy link
Author

How would I use the scripting and assembler without GUI? I'm willing to read the documentation in libpince to do it manually in the meantime.

@korcankaraokcu
Copy link
Owner

korcankaraokcu commented Dec 31, 2023

Open a console in pince root folder and activate the python env, then launch python with root privs like PINCE.sh does. So, in short:

. .venv/PINCE/bin/activate
sudo -E --preserve-env=PATH PYTHONDONTWRITEBYTECODE=1 python3

This will let you use the libs required by pince, they are installed locally. To attach to your process, you can use this code snippet:

from libpince import debugcore, utils
pid = utils.search_processes("process name")[0][0]
debugcore.attach(pid)
debugcore.interrupt_inferior()

This basically searches for your process and returns the first match, then attaches and stops it. To continue the process, you can use debugcore.continue_inferior

You can use utils.assemble to generate assembly code and debugcore.modify_instruction to modify the instruction with the code you generated. You can either read their documentation or refer to the reference widget that can be found in memory window->help

@MasterCATZ
Copy link

speaking of cheat engine any plans to have a way to import cheat engine tables ?

@brkzlr
Copy link
Collaborator

brkzlr commented Jan 2, 2024

speaking of cheat engine any plans to have a way to import cheat engine tables ?

No, there won't be such a thing as it doesn't make sense. Memory layout between Windows and Linux are different so the table would still need to be modified for it to work.

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

No branches or pull requests

4 participants