Created
February 8, 2020 20:15
-
-
Save cetfor/f7b21a92e5be960019aa85cdb65ca22e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Get MLIL SSA form | |
import binaryninja | |
target = "cwe369A_x64" | |
target_operations = [ | |
binaryninja.MediumLevelILOperation.MLIL_DIVS, | |
binaryninja.MediumLevelILOperation.MLIL_DIVS_DP, | |
binaryninja.MediumLevelILOperation.MLIL_DIVU, | |
binaryninja.MediumLevelILOperation.MLIL_DIVU_DP, | |
binaryninja.MediumLevelILOperation.MLIL_FDIV, | |
] | |
print("Analyzing file: {}".format(target)) | |
bv = binaryninja.BinaryViewType.get_view_of_file(target) | |
bv.add_analysis_option('linearsweep') | |
for func in bv.functions: | |
if func.name != "main": continue | |
print("Function: {}".format(func.name)) | |
for block in func.medium_level_il.ssa_form: | |
for instr in block: | |
for operand in instr.postfix_operands: | |
if operand in target_operations: | |
print("Div: {}".format(instr)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment