Example #1
0
 def ti_changed(self, ea, typeinf, fnames):
     res = ida_struct.get_member_by_id(ea)
     if res is not None:
         m, name, sptr = res
         if sptr.is_frame():
             func = ida_funcs.get_func(ida_frame.get_func_by_frame(sptr.id))
             if func is not None:
                 return self.func_updated(func)
     elif utils.is_func(ea):
         return self.func_updated(ida_funcs.get_func(ea))
     return 0
Example #2
0
    def struc_created(self, struc_id):
        if CONFIGURATION[DEBUG]:
            print 'DEBUG - Hooks - IDBHook.struc_created(struc_id = 0x%x)' % struc_id

        name = ida_struct.get_struc_name(struc_id)
        print name
        update = idb_push_ops.StructCreatedUpdate(
            update_type=idb_push_ops.UpdateTypes.StackVariableRenamed,
            address=ida_frame.get_func_by_frame(sptr.id),
            data=data,
            offset=mptr.soff,
            var_size=mptr.eoff - mptr.soff)

        return idaapi.IDB_Hooks.struc_created(self, struc_id)
Example #3
0
    def struc_member_renamed(self, sptr, mptr):
        if CONFIGURATION[DEBUG]:
            print 'DEBUG - Hooks - IDBHook.struc_member_renamed(sptr = %s, mptr = %s)' % (
                pprint.pformat(sptr), pprint.pformat(mptr))

        data = ida_struct.get_member_name(mptr.id)
        if sptr.props & 0x40:  # Struct changed is a frame pointer
            update = idb_push_ops.StackVariableUpdate(
                update_type=idb_push_ops.UpdateTypes.StackVariableRenamed,
                address=ida_frame.get_func_by_frame(sptr.id),
                data=data,
                offset=mptr.soff,
                var_size=mptr.eoff - mptr.soff)
        else:
            return idaapi.IDB_Hooks.struc_member_created(self, sptr, mptr)

        if g_hooks_enabled and (data is not None) and (len(data) > 0):
            send_push_update(update)

        return idaapi.IDB_Hooks.struc_member_renamed(self, sptr, mptr)