Strings
strings
Classes:
-
StringItem
–Represents detailed information about a string in the IDA database.
-
StringListConfig
–Configuration for building the internal string list.
-
StringType
–String type constants.
-
Strings
–Provides access to string-related operations in the IDA database.
StringItem
dataclass
StringItem(address: ea_t, length: int, type: StringType)
Represents detailed information about a string in the IDA database.
Attributes:
address
instance-attribute
address: ea_t
length
instance-attribute
length: int
StringListConfig
dataclass
StringListConfig(
string_types: list[StringType] = lambda: [C](),
min_len: int = 5,
only_ascii_7bit: bool = True,
only_existing: bool = False,
ignore_instructions: bool = False,
)
Configuration for building the internal string list.
Attributes:
-
ignore_instructions
(bool
) – -
min_len
(int
) – -
only_ascii_7bit
(bool
) – -
only_existing
(bool
) – -
string_types
(list[StringType]
) –
ignore_instructions
class-attribute
instance-attribute
ignore_instructions: bool = False
min_len
class-attribute
instance-attribute
min_len: int = 5
only_ascii_7bit
class-attribute
instance-attribute
only_ascii_7bit: bool = True
only_existing
class-attribute
instance-attribute
only_existing: bool = False
string_types
class-attribute
instance-attribute
string_types: list[StringType] = field(
default_factory=lambda: [C]
)
StringType
Bases: IntEnum
String type constants.
Attributes:
-
C
– -
C_16
– -
C_32
– -
LEN2
– -
LEN2_16
– -
LEN2_32
– -
LEN4
– -
LEN4_16
– -
LEN4_32
– -
PASCAL
– -
PASCAL_16
– -
PASCAL_32
–
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
LEN4
class-attribute
instance-attribute
LEN4 = STRTYPE_LEN4
LEN4_16
class-attribute
instance-attribute
LEN4_16 = STRTYPE_LEN4_16
LEN4_32
class-attribute
instance-attribute
LEN4_32 = STRTYPE_LEN4_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)
Bases: DatabaseEntity
Provides access to string-related operations in the IDA database.
Can be used to iterate over all strings in the opened database.
Args: database: Reference to the active IDA database.
Methods:
-
clear
–Clear the string list, strings will not be saved in the database.
-
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.
-
rebuild
–Rebuild the string list from scratch.
Attributes:
-
database
(Database
) –Get the database reference, guaranteed to be non-None when called from
-
m_database
–
database
property
database: Database
Get the database reference, guaranteed to be non-None when called from methods decorated with @check_db_open.
Returns: The active database instance.
Note: This property should only be used in methods decorated with @check_db_open, which ensures m_database is not None.
m_database
instance-attribute
m_database = database
clear
clear() -> None
Clear the string list, strings will not be saved in the database.
get_all
get_all() -> Iterator[StringItem]
Retrieves an iterator over all extracted strings in the database.
Returns: An iterator over all strings.
get_at
get_at(ea: ea_t) -> Optional[StringItem]
Retrieves detailed string information at the specified address.
Args: ea: The effective address.
Returns: A StringItem object if found, None otherwise.
Raises: InvalidEAError: If the effective address is invalid.
get_at_index
get_at_index(index: int) -> StringItem
Retrieves the string at the specified index.
Args: index: Index of the string to retrieve.
Returns: A StringItem object at the given index. In case of error, returns None.
get_between
get_between(
start_ea: ea_t, end_ea: ea_t
) -> Iterator[StringItem]
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.
Raises: InvalidEAError: If start_ea or end_ea are not within database bounds. InvalidParameterError: If start_ea >= end_ea.
rebuild
rebuild(
config: StringListConfig = StringListConfig(),
) -> None
Rebuild the string list from scratch. This should be called to get an up-to-date string list.