Last active
November 29, 2025 13:06
-
-
Save AndnixSH/d5e812dc68e0a398a2681cd84320a50d to your computer and use it in GitHub Desktop.
il2cpp_header_to_ghidra.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import re | |
| import os | |
| header = "typedef unsigned __int8 uint8_t;\n" \ | |
| "typedef unsigned __int16 uint16_t;\n" \ | |
| "typedef unsigned __int32 uint32_t;\n" \ | |
| "typedef unsigned __int64 uint64_t;\n" \ | |
| "typedef __int8 int8_t;\n" \ | |
| "typedef __int16 int16_t;\n" \ | |
| "typedef __int32 int32_t;\n" \ | |
| "typedef __int64 int64_t;\n" \ | |
| "typedef __int64 intptr_t;\n" \ | |
| "typedef __int64 uintptr_t;\n" \ | |
| "typedef unsigned __int64 size_t;\n" \ | |
| "typedef _Bool bool;\n" | |
| def main(): | |
| fixed_header_data = "" | |
| headerfile = askFile("il2cpp.h from Il2cppdumper", "Open") | |
| with open(headerfile.absolutePath, 'r') as f: | |
| print("il2cpp.h opened...") | |
| original_header_data = f.read() | |
| print("il2cpp.h read...") | |
| fixed_header_data = re.sub(r": (\w+) {", r"{\n \1 super;", original_header_data) | |
| print("il2cpp.h data fixed...") | |
| print("il2cpp.h closed.") | |
| with open(os.path.join(os.path.dirname(headerfile.absolutePath), "il2cpp_ghidra.h"), 'w') as f: | |
| print("il2cpp_ghidra.h opened...") | |
| f.write(header) | |
| print("header written...") | |
| f.write(fixed_header_data) | |
| print("fixed data written...") | |
| print("il2cpp_ghidra.h closed.") | |
| if __name__ == '__main__': | |
| print("Script started...") | |
| main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
thanks.