Skip to content

Instantly share code, notes, and snippets.

@uyjulian
Created February 24, 2024 03:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save uyjulian/65b5cc3aad9f283e55b20441535ff3b9 to your computer and use it in GitHub Desktop.
Save uyjulian/65b5cc3aad9f283e55b20441535ff3b9 to your computer and use it in GitHub Desktop.
import idaapi, idc, inspect, ida_bytes, ida_nalt
for i in range(8):
arrptr = int.from_bytes(idc.get_bytes(0x2AD200 + (i * 4), 4), byteorder="little")
for j in range(527):
strptr = int.from_bytes(idc.get_bytes(arrptr + (j * 4), 4), byteorder="little")
numbytes = ida_bytes.get_max_strlit_length(strptr, ida_nalt.STRTYPE_TERMCHR, ida_bytes.ALOPT_IGNHEADS | ida_bytes.ALOPT_IGNCLT)
ida_bytes.del_items(strptr, ida_bytes.DELIT_EXPAND, numbytes)
ida_bytes.create_strlit(strptr, numbytes, ida_nalt.STRTYPE_TERMCHR)
for i in range(8):
arrptr = int.from_bytes(idc.get_bytes(0x2AD200 + (i * 4), 4), byteorder="little")
with open("hoge_0x%08x.txt" % arrptr, "wb") as f:
for j in range(527):
strptr = int.from_bytes(idc.get_bytes(arrptr + (j * 4), 4), byteorder="little")
numbytes = ida_bytes.get_max_strlit_length(strptr, ida_nalt.STRTYPE_TERMCHR, ida_bytes.ALOPT_IGNHEADS | ida_bytes.ALOPT_IGNCLT)
bytez = idc.get_bytes(strptr, numbytes)
f.write(bytes(b"" if bytez == None else bytez).replace(b"\n", b"\\n")[:-1] + b"\n")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment