Skip to content
Discussion options

You must be logged in to vote

Nope, iterating over the higher order IL's is the correct way. Here's an example that finds all calls to MessageBoxA and prints the the popup string.

    for func in bv.functions:
        for block in func.mlil:
            for instr in block:
                if instr.operation != MediumLevelILOperation.MLIL_CALL: continue
                if instr.operands[1].tokens[0].text != 'MessageBoxA': continue

                (hWnd, lpText, lpCaption, uType) = instr.operands[2]
                string_ref = bv.get_string_at(lpText.value.value)
                print('%08X: MessageBoxA(..., "%s", ...)' % (instr.address, string_ref.value))

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by lwerdna
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants