Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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
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 = []