def setup(self, strtypes=STR_C, minlen=5, only_7bit=True, ignore_instructions=False, ea1=None, ea2=None, display_only_existing_strings=False): if ea1 is None: ea1 = idaapi.cvar.inf.minEA if ea2 is None: ea2 = idaapi.cvar.inf.maxEA t = idaapi.strwinsetup_t() t.strtypes = strtypes t.minlen = minlen t.only_7bit = only_7bit t.ea1 = ea1 t.ea2 = ea2 t.display_only_existing_strings = display_only_existing_strings idaapi.set_strlist_options(t) # Automatically refreshes self.refresh()
def setup(self, strtypes = STR_C, minlen = 5, only_7bit = True, ignore_instructions = False, ea1 = None, ea2 = None, display_only_existing_strings = False): if ea1 is None: ea1 = idaapi.cvar.inf.minEA if ea2 is None: ea2 = idaapi.cvar.inf.maxEA t = idaapi.strwinsetup_t() t.strtypes = strtypes t.minlen = minlen t.only_7bit = only_7bit t.ea1 = ea1 t.ea2 = ea2 t.display_only_existing_strings = display_only_existing_strings idaapi.set_strlist_options(t) # Automatically refreshes self.refresh()
def __on_openidb__(cls, code, is_old_database): if code != idaapi.NW_OPENIDB or is_old_database: raise internal.exceptions.InvalidParameterError( u"{:s}.__on_openidb__({:#x}, {:b}) : Hook was called with an unexpected code or an old database." .format('.'.join((__name__, cls.__name__)), code, is_old_database)) config = idaapi.strwinsetup_t() config.minlen = 3 config.ea1, config.ea2 = idaapi.cvar.inf.minEA, idaapi.cvar.inf.maxEA config.display_only_existing_strings = True config.only_7bit = True config.ignore_heads = False # aggregate all the string types for IDA 6.95x if idaapi.__version__ < 7.0: res = [ idaapi.ASCSTR_TERMCHR, idaapi.ASCSTR_PASCAL, idaapi.ASCSTR_LEN2, idaapi.ASCSTR_UNICODE, idaapi.ASCSTR_LEN4, idaapi.ASCSTR_ULEN2, idaapi.ASCSTR_ULEN4 ] # otherwise use IDA 7.x's naming scheme else: res = [ idaapi.STRTYPE_TERMCHR, idaapi.STRTYPE_PASCAL, idaapi.STRTYPE_LEN2, idaapi.STRTYPE_C_16, idaapi.STRTYPE_LEN4, idaapi.STRTYPE_LEN2_16, idaapi.STRTYPE_LEN4_16 ] config.strtypes = reduce(lambda t, c: t | (2**c), res, 0) if not idaapi.set_strlist_options(config): raise internal.exceptions.DisassemblerError( u"{:s}.__on_openidb__({:#x}, {:b}) : Unable to set the default options for the string list." .format('.'.join((__name__, cls.__name__)), code, is_old_database))
def __on_openidb__(cls, code, is_old_database): if code != idaapi.NW_OPENIDB or is_old_database: raise internal.exceptions.InvalidParameterError("{:s}.__on_openidb__({:#x}, {:b}) : Hook was called with an unexpected code or an old database.".format('.'.join((__name__, cls.__name__)), code, is_old_database)) config = idaapi.strwinsetup_t() config.minlen = 3 config.ea1, config.ea2 = idaapi.cvar.inf.minEA, idaapi.cvar.inf.maxEA config.display_only_existing_strings = True config.only_7bit = True config.ignore_heads = False res = [idaapi.ASCSTR_TERMCHR, idaapi.ASCSTR_PASCAL, idaapi.ASCSTR_LEN2, idaapi.ASCSTR_UNICODE, idaapi.ASCSTR_LEN4, idaapi.ASCSTR_ULEN2, idaapi.ASCSTR_ULEN4] config.strtypes = reduce(lambda t, c: t | (2**c), res, 0) assert idaapi.set_strlist_options(config)
def __on_openidb__(cls, code, is_old_database): if code != idaapi.NW_OPENIDB or is_old_database: raise internal.exceptions.InvalidParameterError(u"{:s}.__on_openidb__({:#x}, {:b}) : Hook was called with an unexpected code or an old database.".format('.'.join((__name__, cls.__name__)), code, is_old_database)) config = idaapi.strwinsetup_t() config.minlen = 3 config.ea1, config.ea2 = idaapi.cvar.inf.minEA, idaapi.cvar.inf.maxEA config.display_only_existing_strings = True config.only_7bit = True config.ignore_heads = False res = [idaapi.ASCSTR_TERMCHR, idaapi.ASCSTR_PASCAL, idaapi.ASCSTR_LEN2, idaapi.ASCSTR_UNICODE, idaapi.ASCSTR_LEN4, idaapi.ASCSTR_ULEN2, idaapi.ASCSTR_ULEN4] config.strtypes = reduce(lambda t, c: t | (2**c), res, 0) if not idaapi.set_strlist_options(config): raise internal.exceptions.DisassemblerError(u"{:s}.__on_openidb__({:#x}, {:b}) : Unable to set the default options for the string list.".format('.'.join((__name__, cls.__name__)), code, is_old_database))
def on_openidb(cls, code, is_old_database): if code != idaapi.NW_OPENIDB or is_old_database: raise RuntimeError config = idaapi.strwinsetup_t() config.minlen = 3 config.ea1, config.ea2 = idaapi.cvar.inf.minEA, idaapi.cvar.inf.maxEA config.display_only_existing_strings = True config.only_7bit = True config.ignore_heads = False res = [ idaapi.ASCSTR_TERMCHR, idaapi.ASCSTR_PASCAL, idaapi.ASCSTR_LEN2, idaapi.ASCSTR_UNICODE, idaapi.ASCSTR_LEN4, idaapi.ASCSTR_ULEN2, idaapi.ASCSTR_ULEN4 ] config.strtypes = reduce(lambda t, c: t | (2**c), res, 0) assert idaapi.set_strlist_options(config)