How to use the diagrams.CDotDiagram function in diagrams

To help you get started, we’ve selected a few diagrams examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github joxeankoret / pyew / plugins / fgraphs.py View on Github external
def generateDot(self, f):
        dot = CDotDiagram()
        func = self.pyew.functions[f]
        bbs = {}
        nodes = {}
        for bb in func.basic_blocks:
            instructions = []
            bb_start = bb.instructions[0].offset
            end_offset = bb.instructions[-1].offset
            bb_end = end_offset + bb.instructions[-1].size
            
            buf = self.pyew.getBytes(bb_start, bb_end-bb_start)
            instructions = self.pyew.disassemble(buf=buf, baseoffset=bb_start, marker=False)
            instructions = instructions.replace("\r", "").replace("\n", "\\l")
            instructions = instructions.replace('"', '\"')
            
            bbs[bb_start] = instructions
            bbs[end_offset] = instructions
github joxeankoret / pyew / plugins / fgraphs.py View on Github external
def generateDot(self, func=None):
        if func is None:
            return self.pyew.callgraph.toDot()
        
        dot = CDotDiagram()
        if func is None:
            ep = self.pyew.ep
        else:
            ep = func
        
        if func is None:
            try:
                l = self.pyew.exports.keys()
                l.append(self.pyew.ep)
            except:
                print "Error:", sys.exc_info()[1]
                l = [self.pyew.ep]
        else:
            l = [ep]
        
        functions = []