summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
Diffstat (limited to 'python')
-rw-r--r--python/binaryview.py45
-rw-r--r--python/function.py7
-rw-r--r--python/lowlevelil.py5
3 files changed, 54 insertions, 3 deletions
diff --git a/python/binaryview.py b/python/binaryview.py
index 041974f2..e0e2fbb3 100644
--- a/python/binaryview.py
+++ b/python/binaryview.py
@@ -145,6 +145,27 @@ class AnalysisCompletionEvent(object):
core.BNCancelAnalysisCompletionEvent(self.handle)
+class ActiveAnalysisInfo(object):
+ def __init__(self, func, analysis_time, update_count, submit_count):
+ self.func = func
+ self.analysis_time = analysis_time
+ self.update_count = update_count
+ self.submit_count = submit_count
+
+ def __repr__(self):
+ return "<ActiveAnalysisInfo %s, analysis_time %d, update_count %d, submit_count %d>" % (self.func, self.analysis_time, self.update_count, self.submit_count)
+
+
+class AnalysisInfo(object):
+ def __init__(self, state, analysis_time, active_info):
+ self.state = AnalysisState(state)
+ self.analysis_time = analysis_time
+ self.active_info = active_info
+
+ def __repr__(self):
+ return "<AnalysisInfo %s, analysis_time %d, active_info %s>" % (self.state, self.analysis_time, self.active_info)
+
+
class AnalysisProgress(object):
def __init__(self, state, count, total):
self.state = state
@@ -156,6 +177,8 @@ class AnalysisProgress(object):
return "Disassembling (%d/%d)" % (self.count, self.total)
if self.state == AnalysisState.AnalyzeState:
return "Analyzing (%d/%d)" % (self.count, self.total)
+ if self.state == AnalysisState.ExtendedAnalyzeState:
+ return "Extended Analysis"
return "Idle"
def __repr__(self):
@@ -934,6 +957,20 @@ class BinaryView(object):
self.file.saved = value
@property
+ def analysis_info(self):
+ """Relevant analysis information with list of functions under active analysis (read-only)"""
+ info_ref = core.BNGetAnalysisInfo(self.handle)
+ info = info_ref[0]
+ active_info_list = []
+ for i in xrange(0, info.count):
+ func = function.Function(self, core.BNNewFunctionReference(info.activeInfo[i].func))
+ active_info = ActiveAnalysisInfo(func, info.activeInfo[i].analysisTime, info.activeInfo[i].updateCount, info.activeInfo[i].submitCount)
+ active_info_list.append(active_info)
+ result = AnalysisInfo(info.state, info.analysisTime, active_info_list)
+ core.BNFreeAnalysisInfo(info_ref)
+ return result
+
+ @property
def analysis_progress(self):
"""Status of current analysis (read-only)"""
result = core.BNGetAnalysisProgress(self.handle)
@@ -1025,6 +1062,14 @@ class BinaryView(object):
return function.RegisterValue(self.arch, result.value, confidence = result.confidence)
@property
+ def parameters_for_analysis(self):
+ return core.BNGetParametersForAnalysis(self.handle)
+
+ @parameters_for_analysis.setter
+ def parameters_for_analysis(self, params):
+ core.BNSetParametersForAnalysis(self.handle, params)
+
+ @property
def max_function_size_for_analysis(self):
"""Maximum size of function (sum of basic block sizes in bytes) for auto analysis"""
return core.BNGetMaxFunctionSizeForAnalysis(self.handle)
diff --git a/python/function.py b/python/function.py
index 6db44e6d..2f794f47 100644
--- a/python/function.py
+++ b/python/function.py
@@ -24,7 +24,7 @@ import ctypes
# Binary Ninja components
import _binaryninjacore as core
-from enums import (FunctionGraphType, BranchType, SymbolType, InstructionTextTokenType,
+from enums import (AnalysisSkipReason, FunctionGraphType, BranchType, SymbolType, InstructionTextTokenType,
HighlightStandardColor, HighlightColorStyle, RegisterValueType, ImplicitRegisterExtend,
DisassemblyOption, IntegerDisplayType, InstructionTextTokenContext, VariableSourceType,
FunctionAnalysisSkipOverride)
@@ -828,6 +828,11 @@ class Function(object):
"""Whether automatic analysis was skipped for this function"""
return core.BNIsFunctionAnalysisSkipped(self.handle)
+ @property
+ def analysis_skip_reason(self):
+ """Function analysis skip reason"""
+ return AnalysisSkipReason(core.BNGetAnalysisSkipReason(self.handle))
+
@analysis_skipped.setter
def analysis_skipped(self, skip):
if skip:
diff --git a/python/lowlevelil.py b/python/lowlevelil.py
index 34048704..bd1e9349 100644
--- a/python/lowlevelil.py
+++ b/python/lowlevelil.py
@@ -1809,8 +1809,9 @@ class LowLevelILFunction(object):
param_list = []
for param in params:
param_list.append(param.index)
- return self.expr(LowLevelILOperation.LLIL_INTRINSIC, len(outputs), self.add_operand_list(output_list),
- self.arch.get_intrinsic_index(intrinsic), len(params), self.add_operand_list(param_list), flags = flags)
+ call_param = self.expr(LowLevelILOperation.LLIL_CALL_PARAM, len(params), self.add_operand_list(param_list).index)
+ return self.expr(LowLevelILOperation.LLIL_INTRINSIC, len(outputs), self.add_operand_list(output_list).index,
+ self.arch.get_intrinsic_index(intrinsic), call_param.index, flags = flags)
def breakpoint(self):
"""