Skip to content

Instantly share code, notes, and snippets.

@AndnixSH
Last active November 29, 2025 13:06
Show Gist options
  • Select an option

  • Save AndnixSH/d5e812dc68e0a398a2681cd84320a50d to your computer and use it in GitHub Desktop.

Select an option

Save AndnixSH/d5e812dc68e0a398a2681cd84320a50d to your computer and use it in GitHub Desktop.
il2cpp_header_to_ghidra.py
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()
@rushkii
Copy link

rushkii commented Nov 29, 2025

thanks.

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