RunTrace.py 文件源码

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

项目:IDAPython-Scripts 作者: razygon 项目源码 文件源码
def LookDOWN(self, endEA, ea, id, color):
        DEBUG_PRINT( 'Lookdown')
        global g_ColorSnapshot
        next_ea = ea
        next_id = id
        if True == self._dbDict[next_ea]._shown:
            (next_ea, next_id) = self.Get_next_ea_id(next_ea, next_id,1)
      #      print 'next _ea 0x%x'%next_ea
        if next_ea == 0:
            DEBUG_PRINT( "ERROR in LookDOWN, cannot find next index")   #another possibility
            return 0

        if 1 == color:
            COLOR_TAG = self.IDA_LF_COLOR_LOOP1    
        else:
            if 2 == color:
                COLOR_TAG = self.IDA_LF_COLOR_LOOP2
            else:
                if 3 == color:
                    COLOR_TAG = self.IDA_LF_COLOR_LOOP3    
                else:
                    COLOR_TAG = self.IDA_LF_COLOR_TAG          
        DEBUG_PRINT( 'color_tag 0x%x'%COLOR_TAG)
        while True:            
            if True == self._dbDict[next_ea]._shown:
                DEBUG_PRINT('TruE 0x%x'%next_ea)
                DEBUG_PRINT( 'lookdown finished, tag the after instructions pink')
                DEBUG_PRINT( 'down  max ea 0x%x'%(self.max_ea))
                return 1
            else:
                self._ApdComm(next_ea, next_id)
                if next_ea in g_ColorSnapshot.data.keys():
                    DEBUG_PRINT( 'append color 0x%x'%next_ea)
#                     g_ColorSnapshot.data[next_ea] = idapython.GetLineColor(next_ea)
#                     g_ColorSnapshot.Save()
                    idc.SetColor(next_ea,self.CIC_ID,g_ColorSnapshot.data[next_ea])
                    self.colorsnapshot[next_ea] = g_ColorSnapshot.data[next_ea]
                else:
                    idc.SetColor(next_ea,self.CIC_ID,COLOR_TAG)
                    self.colorsnapshot[next_ea]=COLOR_TAG

            if next_ea == endEA:
                DEBUG_PRINT( 'end address ')
                return 1
#            print 'next_ea: 0x%8X next_id %d'%(next_ea, next_id)
            (next_ea, next_id) = self.Get_next_ea_id(next_ea, next_id,1)
            if next_ea == 0:
                DEBUG_PRINT( 'end of function (may be a callout)')
                DEBUG_PRINT( 'max ea 0x%x'%self.max_ea)
                return 0
            next_idx = self._dbDict[next_ea]._idx_list[next_id][0]
            if(next_ea>self.max_ea):
                self.max_ea = next_ea
            if(next_ea<self.min_ea): 
                self.min_ea = next_ea
            if next_idx > self.max_idx:
                self.max_idx = next_idx
            if next_idx < self.min_idx:
                self.min_idx = next_idx
        return 1
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号