Files
idapython-src/examples/core/list_strings.py
T
2022-08-22 10:14:21 +02:00

23 lines
687 B
Python

"""
summary: retrieve the strings that are present in the IDB
description:
This uses `idautils.Strings` to iterate over the string literals
that are present in the IDB. Contrary to @show_selected_strings,
this will not require that the "Strings" window is opened & available.
see_also: show_selected_strings
"""
from __future__ import print_function
import ida_nalt
import idautils
s = idautils.Strings(False)
s.setup(strtypes=[ida_nalt.STRTYPE_C, ida_nalt.STRTYPE_C_16])
for i, v in enumerate(s):
if v is None:
print("Failed to retrieve string index %d" % i)
else:
print("%x: len=%d type=0x%x index=%d-> '%s'" % (v.ea, v.length, v.strtype, i, str(v)))