summaryrefslogtreecommitdiff
path: root/python/examples/bin_info.py
diff options
context:
space:
mode:
authorRusty Wagner <rusty@vector35.com>2016-10-10 18:24:38 -0400
committerRusty Wagner <rusty@vector35.com>2016-10-10 18:24:38 -0400
commit98d187d9d86506ea915731266b8faaaa2dc0c9d6 (patch)
treefa1ee82d342c12ed5d42e7caf9397312edf7cf63 /python/examples/bin_info.py
parent4598adb7ae961e69fb6ed3e594c0244c49eef511 (diff)
parent55ac7a184b7956c0c2e2ca41d512e7c4a81267d9 (diff)
Merge commit '55ac7a184b7956c0c2e2ca41d512e7c4a81267d9'
Diffstat (limited to 'python/examples/bin_info.py')
-rw-r--r--python/examples/bin_info.py34
1 files changed, 34 insertions, 0 deletions
diff --git a/python/examples/bin_info.py b/python/examples/bin_info.py
new file mode 100644
index 00000000..48073894
--- /dev/null
+++ b/python/examples/bin_info.py
@@ -0,0 +1,34 @@
+#!/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_and_wait()
+
+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)