vfsfitvnm / frida-il2cpp-bridge

A Frida module to dump, trace or hijack any Il2Cpp application at runtime, without needing the global-metadata.dat file.
https://github.com/vfsfitvnm/frida-il2cpp-bridge/wiki
MIT License
946 stars 194 forks source link

how to edit fields? if possible, without using field #362

Closed EduModsS closed 11 months ago

EduModsS commented 11 months ago

i want edit field using fieldName or fieldOfsset, let's say the class name is 'testClass' and have only method called '.ctor' and have field 'testField' and only offset 0x1C, fieldType = long, how fo edit? and if fieldType is int how to correct edit? thanks

vfsfitvnm commented 11 months ago

If the field is static, you need the pointer to the class' static fields (il2cpp_class_get_static_field_data), then simply add the field offset to it, then readInt or whatever. Otherwise, use the object pointer instead.

EduModsS commented 11 months ago

if the field is not static? I learned to edit using the name, but I didn't find anything about going by his offset, how to do it by offset? using class object

vfsfitvnm commented 11 months ago

This is how I do it: https://github.com/vfsfitvnm/frida-il2cpp-bridge/blob/3754f1e9ee77eadede4953e11bb647cb0a2ec025/src/il2cpp/structs/field.ts#L117