Skip to content

Instantly share code, notes, and snippets.

@RobinDavid
Created January 7, 2025 21:12
Show Gist options
  • Save RobinDavid/083079417a7ba1227ba9fc8ad2898c11 to your computer and use it in GitHub Desktop.
Save RobinDavid/083079417a7ba1227ba9fc8ad2898c11 to your computer and use it in GitHub Desktop.
Try creating strings whenever possible in the given range in IDA
import ida_bytes
from ida_idaapi import BADADDR
import ida_nalt
def mk_strings(ea: int, end: int = BADADDR):
addr = ea
while True:
addr = ida_bytes.next_unknown(addr, end)
if addr == end:
break
c = ida_bytes.get_byte(addr)
if str(c).isprintable():
if ida_bytes.create_strlit(addr, 0, ida_nalt.STRTYPE_C):
s = ida_bytes.get_strlit_contents(addr, -1, ida_nalt.STRTYPE_C)
print(f"{addr:#08x} -> {s}")
else:
pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment