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

Improper division into basic blocks  #36

@0x123456789

Description

@0x123456789

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):
code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions