This repository was archived by the owner on Apr 23, 2025. It is now read-only.

Description
Hello, I try to enumerate all basic blocks using the following code:
from pyew import CPyew
def main(f):
pyew = CPyew(plugins=True, batch=True)
pyew.loadFile(f)
ca = pyew._anal
for _, block in ca.basic_blocks.iteritems():
for instr in block.instructions:
print "%s %s" % (instr.mnemonic, instr.operands)
print '--------------------------------------------'
if __name__ == "__main__":
if len(sys.argv) == 1:
print "Usage:", sys.argv[0], "<program file>"
else:
main(sys.argv[1])
It get's me basic blocks, but some of them are incorrect because the last instruction in them is not ret, call, jmp and etc. Here the example (here you can see that the last block instruction is mov):
