summaryrefslogtreecommitdiff
path: root/python/__init__.py
diff options
context:
space:
mode:
authorRusty Wagner <rusty@vector35.com>2016-06-30 17:15:19 -0400
committerRusty Wagner <rusty@vector35.com>2016-06-30 17:15:32 -0400
commita7eaa72caa4a5e3e7cd7ea7c32236c93b06d1442 (patch)
treeef0178c735374bc86f499379a342e6a61b916367 /python/__init__.py
parent32153536526753edc3e80ea43512ad7ab65a3271 (diff)
Add API for analysis progress
Diffstat (limited to 'python/__init__.py')
-rw-r--r--python/__init__.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/python/__init__.py b/python/__init__.py
index 3d2123b3..e07bd7c5 100644
--- a/python/__init__.py
+++ b/python/__init__.py
@@ -650,6 +650,22 @@ class AnalysisCompletionEvent(object):
self.callback = self._empty_callback
core.BNCancelAnalysisCompletionEvent(self.handle)
+class AnalysisProgress(object):
+ def __init__(self, state, count, total):
+ self.state = state
+ self.count = count
+ self.total = total
+
+ def __str__(self):
+ if self.state == core.DisassembleState:
+ return "Disassembling (%d/%d)" % (self.count, self.total)
+ if self.state == core.AnalyzeState:
+ return "Analyzing (%d/%d)" % (self.count, self.total)
+ return "Idle"
+
+ def __repr__(self):
+ return "<progress: %s>" % str(self)
+
class BinaryView(object):
name = None
"""Binary View name"""
@@ -928,6 +944,12 @@ class BinaryView(object):
def saved(self, value):
self.file.saved = value
+ @property
+ def analysis_progress(self):
+ """Status of current analysis (read-only)"""
+ result = core.BNGetAnalysisProgress(self.handle)
+ return AnalysisProgress(result.state, result.count, result.total)
+
def __len__(self):
return int(core.BNGetViewLength(self.handle))