RunTrace.py 文件源码

python
阅读 29 收藏 0 点赞 0 评论 0

项目:IDAPython-Scripts 作者: razygon 项目源码 文件源码
def BackwardView(self,ea,id, innermode = 0): #'<', DEFAULT VIEW
        DEBUG_PRINT('Backward')
        if innermode == 0:
            ea = idc.ScreenEA()
            self._choose_ea = ea
            id = self.GetID(ea, self.GetIDX(ea))
        self.max_ea = ea
        self.min_ea = ea
        self.max_idx = 0
        self.min_idx = 0
        color = 1
        (startEA,endEA) = self._GetFuncRange(ea)
        self.ColorCompare()
        self._delComms(startEA,endEA)
#        endEA = decode_prev_insn(endEA)
        (down_ea, up_ea) = (ea,ea)
        (down_id, up_id) = (id,id)  
#        print 'max 0x%x end 0x%x'%(self.max_ea,endEA)
#        print 'min 0x%x start 0x%x'%(self.min_ea,startEA)

        while(self.max_ea <= endEA and self.min_ea >= startEA and color <4):
            DEBUG_PRINT( 'in while')
            DEBUG_PRINT( 'max 0x%x'%self.max_ea)
            DEBUG_PRINT( 'min 0x%x'%self.min_ea)
            self.LookUP(startEA,up_ea,up_id,color)
            self.LookDOWN(endEA,down_ea,down_id,color)
            if [] == self._dbDict[self.max_ea]._xref_from and [] == self._dbDict[self.min_ea]._xref_to:
                break
            if [] != self._dbDict[self.max_ea]._xref_from:
                (down_ea, down_id) = self.Get_Down()
                if -1 == down_ea:
                    (down_ea, down_id) = (ea,id)

            if [] != self._dbDict[self.min_ea]._xref_to:  
                (up_ea, up_id) = self.Get_Up()
                if -1 == up_ea:
                    (up_ea, up_id) = (ea,id)
            DEBUG_PRINT(color)
            color = color+1 
        print 'Backward View finished'
        cid = [i for i,item in enumerate(self._tablelist) if item[0]==hex(startEA)]
        if cid != []:
            cindex = cid[0]
            self._tablelist[cindex][2] = '3'
        else:
            print 'ea not in range'
        idc.Refresh()
        return
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号