summaryrefslogtreecommitdiff
path: root/python/examples/bin-info.py
diff options
context:
space:
mode:
authorJordan Wiens <jordan@psifertex.com>2016-04-11 11:55:14 -0400
committerJordan Wiens <jordan@psifertex.com>2016-04-11 11:55:14 -0400
commit716a5c3e5e7af964665e4e2b952d3ee874dcc0f8 (patch)
tree62e9239a7c301a601957de4621900444ffd7c571 /python/examples/bin-info.py
parent69aafc8c09174ebf9bba399831261e0c08ef71fc (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.py37
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)