diff options
| author | Jordan Wiens <jordan@psifertex.com> | 2016-04-11 11:55:14 -0400 |
|---|---|---|
| committer | Jordan Wiens <jordan@psifertex.com> | 2016-04-11 14:32:05 -0400 |
| commit | 57d00b0eee4f55163e40705aedaec3ecc16c8ef2 (patch) | |
| tree | 62e9239a7c301a601957de4621900444ffd7c571 /python/examples/bin-info.py | |
| parent | 69aafc8c09174ebf9bba399831261e0c08ef71fc (diff) | |
adding readme, arm-syscall, bin-info, and breakpoint plugins
Diffstat (limited to 'python/examples/bin-info.py')
| -rw-r--r-- | python/examples/bin-info.py | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/python/examples/bin-info.py b/python/examples/bin-info.py new file mode 100644 index 00000000..6ec00bce --- /dev/null +++ b/python/examples/bin-info.py @@ -0,0 +1,37 @@ +#!/usr/bin/env python +import sys, binaryninja, time +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 = binaryninja.BinaryViewType[bintype].open(target) +bv.update_analysis() + +"""Until update_analysis_and_wait is complete, sleep is necessary as the analysis is multi-threaded.""" +time.sleep(1) + +print "-------- %s --------" % target +print "START: 0x%x" % bv.start +print "ENTRY: 0x%x" % bv.entry_point +print "ARCH: %s" % bv.arch.name +print "\n-------- Function List --------" + +for func in bv.functions: + print func.symbol.name + + +print "\n-------- First 10 strings --------" + +for i in xrange(10): + start = bv.strings[i].start + length = bv.strings[i].length + string = bv.read(start,length) + print "0x%x (%d):\t%s" % (start, length, string) |
