コード例 #1
0
ファイル: funcgraph.py プロジェクト: snemes/vivisect
    def _hotkey_paintUp(self, va=None):
        '''
        Paint the VA's from the selected basic block up to all possible 
        non-looping starting points.
        '''
        graph = viv_graphutil.buildFunctionGraph(self.vw,
                                                 self.fva,
                                                 revloop=True)
        startva = self.mem_canvas._canv_curva
        if startva == None:
            return

        viv_graphutil.preRouteGraphUp(graph, startva, mark='hit')

        count = 0
        colormap = {}
        for node in graph.getNodesByProp('hit'):
            count += 1
            off = 0
            cbsize = node[1].get('cbsize')
            if cbsize == None:
                raise Exception('node has no cbsize: %s' % repr(node))

            # step through opcode for a node
            while off < cbsize:
                op = self.vw.parseOpcode(node[0] + off)
                colormap[op.va] = 'orange'
                off += len(op)

        self.vw.vprint("Colored Blocks: %d" % count)
        vqtevent('viv:colormap', colormap)
        return colormap
コード例 #2
0
ファイル: funcgraph.py プロジェクト: digdugg/vivisect
    def _hotkey_paintUp(self, va=None):
        """
        Paint the VA's from the selected basic block up to all possible 
        non-looping starting points.
        """
        graph = viv_graphutil.buildFunctionGraph(self.vw, self.fva, revloop=True)
        startva = self.mem_canvas._canv_curva
        if startva == None:
            return

        viv_graphutil.preRouteGraphUp(graph, startva, mark="hit")

        count = 0
        colormap = {}
        for node in graph.getNodesByProp("hit"):
            count += 1
            off = 0
            cbsize = node[1].get("cbsize")
            if cbsize == None:
                raise Exception("node has no cbsize: %s" % repr(node))

            # step through opcode for a node
            while off < cbsize:
                op = self.vw.parseOpcode(node[0] + off)
                colormap[op.va] = "orange"
                off += len(op)

        self.vw.vprint("Colored Blocks: %d" % count)
        vqtevent("viv:colormap", colormap)
        return colormap