def refresh(self, ea1=None, ea2=None): """Refreshes the strings list""" if ea1 is None: ea1 = idaapi.cvar.inf.minEA if ea2 is None: ea2 = idaapi.cvar.inf.maxEA idaapi.refresh_strlist(ea1, ea2) self.size = idaapi.get_strlist_qty()
def findMetadataCacheInitialize(): def checkTarget(func): #check write to global values' count. hitcount = 0 for xref in func.xrefs_from: segment = idaapi.getseg(xref.to) if idaapi.get_visible_segm_name(segment) == '.bss' and repr( xref.type) == "Data_Write": hitcount += 1 if hitcount >= 8 and hitcount < 12: return 1 return 0 # find addr of "global-metadata.dat" global_metadata = None s = idaapi.string_info_t() for i in range(0, idaapi.get_strlist_qty()): idaapi.get_strlist_item(s, i) if idaapi.get_ascii_contents(s.ea, s.length, s.type) == "global-metadata.dat": global_metadata = s.ea break # xref of "global-metadata.dat" for xref in sark.Line(global_metadata).xrefs_to: if sark.Function.is_function(xref.frm): target_func = sark.Function(xref.frm) if checkTarget(target_func): # print "find MetadataCache::Initialize at", hex(int(target_func.startEA)) idc.set_name(target_func.startEA, "MetadataCache_Initialize", SN_NOWARN | SN_NOCHECK) return else: for txref in target_func.xrefs_to: if sark.Function.is_function(txref.frm): caller = sark.Function(txref.frm) if checkTarget(caller): # print "find MetadataCache::Initialize at", hex(int(caller.startEA)) idc.set_name(caller.startEA, "MetadataCache_Initialize", SN_NOWARN | SN_NOCHECK) return print "can't find MetadataCache_Initialize"
def size(cls): '''Return the number of elements in the strings list.''' return idaapi.get_strlist_qty()
def size(cls): return idaapi.get_strlist_qty()