diff options
| author | Peter LaFosse <peter@vector35.com> | 2018-07-13 11:20:49 -0400 |
|---|---|---|
| committer | Peter LaFosse <peter@vector35.com> | 2018-07-13 11:20:49 -0400 |
| commit | 30bbb5a8a18183e8e7921ddd047c4cdd14c360ea (patch) | |
| tree | 37fd1d15c6b85572caf83bcf172e97949aa74f59 /python/binaryview.py | |
| parent | d0c8cf49ecb114b81007920b2e4e2b1ae168dbc4 (diff) | |
| parent | 838cb56a8505fc78d09befedd58dd632eeb2ee62 (diff) | |
Merging with dev
Diffstat (limited to 'python/binaryview.py')
| -rw-r--r-- | python/binaryview.py | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/python/binaryview.py b/python/binaryview.py index 3c21e499..5bebec8e 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): @@ -343,6 +366,11 @@ class BinaryViewType(object): return ctypes.addressof(self.handle.contents) != ctypes.addressof(value.handle.contents) @property + def list(self): + """Allow tab completion to discover metaclass list property""" + pass + + @property def name(self): """BinaryView name (read-only)""" return core.BNGetBinaryViewTypeName(self.handle) @@ -1006,6 +1034,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) @@ -1093,6 +1135,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) @@ -2821,6 +2871,8 @@ class BinaryView(object): if start is None: strings = core.BNGetStrings(self.handle, count) else: + if length is None: + length = self.end - start strings = core.BNGetStringsInRange(self.handle, start, length, count) result = [] for i in xrange(0, count.value): |
