Strings
strings
Classes:
-
StringInfo
–Represents detailed information about a string in the IDA database.
-
StringType
–String type constants.
-
Strings
–Provides access to string-related operations in the IDA database.
StringInfo
dataclass
StringInfo(
address: ea_t,
content: str,
length: int,
type: StringType,
)
Represents detailed information about a string in the IDA database.
Methods:
-
get_encoding_info
–Get a human-readable description of the string encoding.
-
is_c_string
–Check if this is a C-style null-terminated string.
-
is_pascal_string
–Check if this is a Pascal-style string.
-
is_unicode
–Check if this is a Unicode string.
Attributes:
-
address
(ea_t
) – -
content
(str
) – -
length
(int
) – -
type
(StringType
) –
address
instance-attribute
address: ea_t
content
instance-attribute
content: str
length
instance-attribute
length: int
get_encoding_info
get_encoding_info() -> str
Get a human-readable description of the string encoding.
is_c_string
is_c_string() -> bool
Check if this is a C-style null-terminated string.
is_pascal_string
is_pascal_string() -> bool
Check if this is a Pascal-style string.
is_unicode
is_unicode() -> bool
Check if this is a Unicode string.
StringType
Bases: IntEnum
String type constants.
Attributes:
C
class-attribute
instance-attribute
C = STRTYPE_C
C_16
class-attribute
instance-attribute
C_16 = STRTYPE_C_16
C_32
class-attribute
instance-attribute
C_32 = STRTYPE_C_32
LEN2
class-attribute
instance-attribute
LEN2 = STRTYPE_LEN2
LEN2_16
class-attribute
instance-attribute
LEN2_16 = STRTYPE_LEN2_16
LEN2_32
class-attribute
instance-attribute
LEN2_32 = STRTYPE_LEN2_32
PASCAL
class-attribute
instance-attribute
PASCAL = STRTYPE_PASCAL
PASCAL_16
class-attribute
instance-attribute
PASCAL_16 = STRTYPE_PASCAL_16
PASCAL_32
class-attribute
instance-attribute
PASCAL_32 = STRTYPE_PASCAL_32
Strings
Strings(database: 'Database')
Provides access to string-related operations in the IDA database.
Constructs a strings handler for the given database.
Args: database: Reference to the active IDA database.
Methods:
-
build_string_list
–Rebuild the string list from scratch.
-
clear_string_list
–Clear the string list.
-
exists_at
–Check if the specified address contains a string.
-
find_strings_containing
–Find all strings containing the specified substring.
-
get_all
–Retrieves an iterator over all extracted strings in the database.
-
get_at
–Retrieves detailed string information at the specified address.
-
get_at_index
–Retrieves the string at the specified index.
-
get_between
–Retrieves strings within the specified address range.
-
get_count
–Retrieves the total number of extracted strings.
-
get_length
–Get the length at the specified address.
-
get_type
–Get the type at the specified address.
Attributes:
m_database
instance-attribute
m_database = database
build_string_list
build_string_list() -> None
Rebuild the string list from scratch. This should be called to get an up-to-date string list.
clear_string_list
clear_string_list() -> None
Clear the string list.
exists_at
exists_at(ea: ea_t) -> bool
Check if the specified address contains a string.
Args: ea: The effective address.
Returns: True if address contains a string, False otherwise.
find_strings_containing
find_strings_containing(
substring: str, case_sensitive: bool = False
) -> Iterator[Tuple[ea_t, str]]
Find all strings containing the specified substring.
Args: substring: Substring to search for. case_sensitive: Whether the search should be case sensitive.
Returns: Iterator over matching strings (address, content).
get_all
get_all() -> Iterator[Tuple[ea_t, str]]
Retrieves an iterator over all extracted strings in the database.
Returns: An iterator over all strings.
get_at
get_at(ea: ea_t) -> StringInfo | None
Retrieves detailed string information at the specified address.
Args: ea: The effective address.
Returns: A StringInfo object if found, None otherwise.
get_at_index
get_at_index(index: int) -> Tuple[ea_t, str] | None
Retrieves the string at the specified index.
Args: index: Index of the string to retrieve.
Returns: A pair (effective address, string content) at the given index. In case of error, returns None.
get_between
get_between(
start_ea: ea_t, end_ea: ea_t
) -> Iterator[Tuple[ea_t, str]]
Retrieves strings within the specified address range.
Args: start_ea: Start address of the range (inclusive). end_ea: End address of the range (exclusive).
Returns: An iterator over strings in the range.
get_count
get_count() -> int
Retrieves the total number of extracted strings.
Returns: The number of stored strings.
get_length
get_length(ea: ea_t) -> int
Get the length at the specified address.
Args: ea: The effective address.
Returns: String length or -1 if not a string.
get_type
get_type(ea: ea_t) -> Union[StringType, int]
Get the type at the specified address.
Args: ea: The effective address.
Returns: String type (StringType enum) or -1 if not a string.