RunTrace.py 文件源码

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

项目:IDAPython-Scripts 作者: razygon 项目源码 文件源码
def ForwardView(self,ea,id, innermode = 0): # '>'.
        DEBUG_PRINT( 'Forward ')
        if innermode == 0:
            ea = idc.ScreenEA()
            id = self.GetID(ea, self.GetIDX(ea))
            self._choose_ea = 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')
            self.LookDOWN(endEA,down_ea,down_id,color)
            self.LookUP(startEA,up_ea,up_id,color)
            if [] == self._dbDict[self.max_ea]._xref_from and [] == self._dbDict[self.min_ea]._xref_to:
                print 'max_ea and min_ea have no xref'
                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 'Forward View is finished'
        idc.Refresh()
        cid = [i for i,item in enumerate(self._tablelist) if item[0]==hex(startEA)]
        if cid != []:
            cindex = cid[0]
            self._tablelist[cindex][2] = '2'
        else:
            print 'ea not in range'
        return
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号