def ti_changed(self, ea, type, fname): return name = "" if ida_struct.is_member_id(ea): name = ida_struct.get_struc_name(ea) type = ida_typeinf.idc_get_type_raw(ea) self._send_packet( evt.TiChangedEvent(ea, (ParseTypeString(type[0]) if type else [], type[1] if type else None), name)) return 0
def renamed(self, ea, new_name, local_name): self._plugin.logger.debug( "renamed(ea = %x, new_name = %s, local_name = %d)" % (ea, new_name, local_name)) if ida_struct.is_member_id(ea) or ida_struct.get_struc( ea) or ida_enum.get_enum_name(ea): # old_name = ida_struct.get_struc_name(ea) return 0 #drop hook for avoid duplicate 'StrucRenamedEvent', 'EnumRenamedEvent' and 'StrucMemberRenamedEvent' self._send_packet(evt.RenamedEvent(ea, new_name, local_name)) return 0
def calc_item_size(self, ea, maxsize): if ida_struct.is_member_id(ea): return 1 # get the opcode and see if it has an imm n = 5 if (ida_bytes.get_byte(ea) & 3) == 0 else 1 # string too big? if n > maxsize: return 0 # ok, accept return n
def ti_changed(self, ea, type, fname): self._plugin.logger.debug( "ti_changed(ea = 0x%X, type = %s, fname = %s)" % (ea, type, fname)) name = "" if ida_struct.is_member_id(ea): name = ida_struct.get_struc_name(ea) type = ida_typeinf.idc_get_type_raw(ea) self._send_packet( evt.TiChangedEvent(ea, (ParseTypeString(type[0]) if type else [], type[1] if type else None), name)) return 0
def renamed(self, ea, new_name, local_name): self._plugin.logger.debug( "renamed(ea = %x, new_name = %s, local_name = %d)" % (ea, new_name, local_name)) if ida_struct.is_member_id(ea) or ida_struct.get_struc( ea) or ida_enum.get_enum_name(ea): # Drop hook to avoid duplicate since already handled by the following hooks: # - renaming_struc_member() -> sends 'StrucMemberRenamedEvent' # - renaming_struc() -> sends 'StrucRenamedEvent' # - renaming_enum() -> sends 'EnumRenamedEvent' return 0 self._send_packet(evt.RenamedEvent(ea, new_name, local_name)) return 0
def calc_item_size(self, ea, maxsize): # Custom data types may be used in structure definitions. If this case # ea is a member id. Check for this situation and return 1 if ida_struct.is_member_id(ea): return 1 # get the length byte n = ida_bytes.get_byte(ea) # string too big? if n > maxsize: return 0 # ok, accept the string return n + 1
def renamed(self, ea, new_name, local_name): # #print("renamed(ea = %x, new_name = %s, local_name = %d)" % (ea, new_name, local_name)) if ida_struct.is_member_id(ea) or ida_struct.get_struc( ea) or ida_enum.get_enum_name(ea): return 0 ida_func = idaapi.get_func(ea) # global var renaming if ida_func is None: size = idaapi.get_item_size(ea) self.binsync_state_change(self.controller.push_artifact, GlobalVariable(ea, new_name, size=size)) # function name renaming elif ida_func.start_ea == ea: # grab the name instead from ida name = idc.get_func_name(ida_func.start_ea) self.binsync_state_change(self.controller.push_artifact, FunctionHeader(name, ida_func.start_ea)) return 0
def renamed(self, ea, new_name, local_name): if CONFIGURATION[DEBUG]: print 'DEBUG - Hooks - IDBHook.renamed(ea = 0x%x, new_name = %s, local_name = %r)' % ( ea, new_name, local_name) if ida_struct.is_member_id(ea) or ida_struct.get_struc(ea): # Change is either a built-in struct of a frame pointer, or some address # starting with 0xFF00 that happens to be a member address. print 'INFO - Hooks - IDBHook.Renamed - Skipping a possible stack variable/built-in struct change' return idaapi.IDB_Hooks.renamed(self, ea, new_name, local_name) if (g_hooks_enabled and (new_name is not None) and (len(new_name) > 0) and (not psida_common.is_default_name(new_name))): name_update = idb_push_ops.NameUpdate( update_type=idb_push_ops.UpdateTypes.Name, address=ea, data=new_name, is_local=local_name) send_push_update(name_update) return idaapi.IDB_Hooks.renamed(self, ea, new_name, local_name)
def renamed(self, ea, new_name, local_name): print("renamed(ea = %x, new_name = %s, local_name = %d)" % (ea, new_name, local_name)) if ida_struct.is_member_id(ea) or ida_struct.get_struc( ea) or ida_enum.get_enum_name(ea): # Drop hook to avoid duplicate since already handled by the following hooks: # - renaming_struc_member() -> sends 'StrucMemberRenamedEvent' # - renaming_struc() -> sends 'StrucRenamedEvent' # - renaming_enum() -> sends 'EnumRenamedEvent' return 0 # confirm we are renaming a function ida_func = idaapi.get_func(ea) if ida_func is None: return 0 # grab the name instead from ida name = idc.get_func_name(ida_func.start_ea) self.controller.make_controller_cmd(self.controller.push_function_name, ida_func.start_ea, name) return 0