https://gameguardian.net/help/classgg.html#a15e72eaba99c1eadac1ccdeb8e2b5009
Has some good info
I would use a site like https://godbolt.org/
I'm using ARM64 gcc trunk
You can write some c++ code like,
int square(int num) {
return num * num;
}
and get asm for it
sub sp, sp, #16
str w0, [sp, 12]
ldr w0, [sp, 12]
mul w0, w0, w0
add sp, sp, 16
ret
then use something like http://shell-storm.org/online/Online-Assembler-and-Disassembler/
I'm using AArch64
This will take your asm and convert it to byte code
"\xff\x43\x00\xd1\xe0\x0f\x00\xb9\xe0\x0f\x40\xb9\x00\x7c\x00\x1b\xff\x43\x00\x91\xc0\x03\x5f\xd6"
You will need to write your own functions, but something like this,
local shell_code = "\xff\x43\x00\xd1\xe0\x0f\x00\xb9\xe0\x0f\x40\xb9\x00\x7c\x00\x1b\xff\x43\x00\x91\xc0\x03\x5f\xd6"
local shell_address = gg.allocatePage(gg.PROT_READ | gg.PROT_WRITE | gg.PROT_EXEC)
local result = hook(offset + base, shell_code, shell_address)
I would recommend reading over this project,
GGInjector (#9c9qcq9g)