From 9d1cac8ee55553cdb20c36deb3b15c9219b02d9b Mon Sep 17 00:00:00 2001 From: Peter LaFosse Date: Sat, 7 Jan 2017 16:08:08 -0500 Subject: More fixes for refactor --- python/examples/instruction_iterator.py | 33 +++++++++++---------------------- 1 file changed, 11 insertions(+), 22 deletions(-) (limited to 'python/examples/instruction_iterator.py') diff --git a/python/examples/instruction_iterator.py b/python/examples/instruction_iterator.py index 47717aa0..7ff2d692 100644 --- a/python/examples/instruction_iterator.py +++ b/python/examples/instruction_iterator.py @@ -22,21 +22,10 @@ import sys import binaryninja as binja - -if sys.platform.lower().startswith("linux"): - bintype = "ELF" -elif sys.platform.lower() == "darwin": - bintype = "Mach-O" -else: - raise Exception("%s is not supported on this plugin" % sys.platform) - if len(sys.argv) > 1: target = sys.argv[1] -else: - target = "/bin/ls" -bv = binja.BinaryViewType[bintype].open(target) -bv.update_analysis_and_wait() +bv = binja.BinaryViewType.get_view_of_file(target) binja.log_to_stdout(True) binja.log_info("-------- %s --------" % target) binja.log_info("START: 0x%x" % bv.start) @@ -46,19 +35,19 @@ binja.log_info("\n-------- Function List --------") """ print all the functions, their basic blocks, and their il instructions """ for func in bv.functions: - binja.log_info(repr(func)) - for block in func.low_level_il: - binja.log_info("\t{0}".format(block)) + binja.log_info(repr(func)) + for block in func.low_level_il: + binja.log_info("\t{0}".format(block)) - for insn in block: - binja.log_info("\t\t{0}".format(insn)) + for insn in block: + binja.log_info("\t\t{0}".format(insn)) """ print all the functions, their basic blocks, and their mc instructions """ for func in bv.functions: - binja.log_info(repr(func)) - for block in func: - binja.log_info("\t{0}".format(block)) + binja.log_info(repr(func)) + for block in func: + binja.log_info("\t{0}".format(block)) - for insn in block: - binja.log_info("\t\t{0}".format(insn)) + for insn in block: + binja.log_info("\t\t{0}".format(insn)) -- cgit v1.3.1