Jump to content
  • 0

Is there any way to call an method with parameters?


BULLETBOT

Question

Posted

How can I do it with the offset?

// RVA: 0x254CA18 Offset: 0x254CA18 VA: 0x254CA18
public void set_Name(string value) { }

I would like to call this method somehow for example.

7 answers to this question

Recommended Posts

Posted

When you dump it a file called : stringliteral.json will be generated including offset of the string (libil2cpp.so start address + offset) get that address (pointer).

 

ldr r0, [set_name_addr] ; load set_Name function address into r0
ldr r1, [str_addr]     ; load string address into r1
blx r0                 ; call set_Name("test")


set_name_addr is the memory address of the set_Name function, and str_addr is the memory address of the string "test". You should replace these addresses with the appropriate values.

Note : Void methods works only on it's class value and it has no return ( more likely for k,v in pairs loop ).
YOU NEED TO CALL THIS METHOD USING ANOTHER METHOD FROM THE SAME CLASS.

 

Posted
1 hour ago, BULLETBOT said:

How do you make it happen in GG Script?

il2cpp = gg.getRangesList('libil2cpp.so') -- this will save il2cpp start and end address
base_addr = il2cpp.start -- this will be the start address of il2cpp
set_Name = base_addr + 0x254CA18 -- we add the offset to get the method address
string_pointer = base_addr + offset -- change offset to the offset in stringlinear.json file
instructions = {
[1] = '~A ldr r0, ['..set_Name..']', --CHANGE ~A to ~A8 if you are using x64
[2] = '~A ldr r1, ['..string_pointer..']',
[3] = '~A blx r0',
}
original = {}
for i = 0 , 2 do -- 0 and 2 is the size of the edit ( each instruction line add +1 to the size bc it take whole 4 bytes address) the i=0 so logic later make sens
original[#original + 1 ] = {address = set_Name + (i * 4) , flags = gg.TYPE_DWORD} -- i * 4 so it add 4 bytes each round in the loop , [#original+1] similar to table.insert()
end
original = gg.getValues(original) -- this will get you the values of each address and refresh it's value
for k,v in pairs(original) do --set the value of each address to the edit instructions
original[k].value = instructions[k]
end
gg.setValues(original) -- we edit the values

Note : this is a basic script method you get the idea and create a script similar to it. also mark it a solution if that answer your question

Posted
On 3/4/2023 at 4:39 AM, BULLETBOT said:

How can I do it with the offset?

// RVA: 0x254CA18 Offset: 0x254CA18 VA: 0x254CA18
public void set_Name(string value) { }

I would like to call this method somehow for example.

If hooking can but use gg is not easy

 

If you use hooking this 

void (*set_NickName) (monoString *name);

void(*old_PlayerScript_UpdateFast)(void *player);
void PlayerScript_UpdateFast(void *player) {
    if(player != nullptr){
        if (NameSpoof) {
           set_NickName(CreateMonoString("Guided Hacking"));
        }
    }

    old_PlayerScript_UpdateFast(player);
}

MSHookFunction((void *) getRealOffset(0x12345), (void *)PlayerScript_UpdateFast, (void **) &old_PlayerScript_UpdateFast);
set_NickName = (void *(*)(monoString *))getRealOffset(0x12345);

public void set_NickName(string value)
private void UpdateFast()

i give this credits
https://forum.sbenny.com/thread/c-android-and-ios-game-hacking-megathread.131788

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.