RunTrace.py 文件源码

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

项目:IDAPython-Scripts 作者: razygon 项目源码 文件源码
def LookUP(self, startEA, ea,id,color):
        global g_ColorSnapshot
        DEBUG_PRINT('LookUP')
        next_ea = ea
        next_id = id

        if True == self._dbDict[next_ea]._shown:
            (next_ea, next_id) = self.Get_previous_ea_id(next_ea, next_id,1)
        if next_ea == 0:
#            print "ERROR in LookUP"
            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:
            DEBUG_PRINT(( 'LookUP While True 0x%x %d'  %(next_ea, next_id)))
            if True == self._dbDict[next_ea]._shown:
                DEBUG_PRINT( 'TruE 0x%x'%next_ea)
                DEBUG_PRINT( 'LookUp finished, tag the pre instructions blue')
                DEBUG_PRINT( 'min ea 0x%x'%(self.min_ea))
                return 1
            else:
                DEBUG_PRINT( 'paint color')
                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 == startEA:
                DEBUG_PRINT( 'lookup reaches startEA 0x%x'%(startEA))
                return 1
            (next_ea, next_id) = self.Get_previous_ea_id(next_ea, next_id,1)
            if next_ea == 0:
#                print "ERROR in LookUP"
                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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号