From 18358328e51883e6658828d39be0f9c45a0d3094 Mon Sep 17 00:00:00 2001 From: Jordan Wiens Date: Fri, 26 Aug 2022 12:19:01 -0400 Subject: rename current_file_offset to current_raw_offset --- docs/getting-started.md | 2 +- python/scriptingprovider.py | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/docs/getting-started.md b/docs/getting-started.md index 05b5419e..d6c6adc3 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -526,7 +526,7 @@ The interactive python prompt also has several built-in functions and variables: - `here` / `current_address`: address of the current selection. It's settable too and will navigate the UI if changed - `current_selection`: a tuple of the start and end addresses of the current selection. It's settable and will change the current selection -- `current_file_offset`: the file offset that corresponds the current address. It's settable and will navigate to the corresponding file offset +- `current_raw_offset`: the file offset that corresponds the current address. It's settable and will navigate to the corresponding file offset - `bv` / `current_view` / : the current [BinaryView](https://api.binary.ninja/binaryninja.binaryview-module.html#binaryninja.binaryview.BinaryView) - `current_function`: the current [Function](https://api.binary.ninja/binaryninja.function-module.html#binaryninja.function.Function) - `current_basic_block`: the current [BasicBlock](https://api.binary.ninja/binaryninja.basicblock-module.html#binaryninja.basicblock.BasicBlock) diff --git a/python/scriptingprovider.py b/python/scriptingprovider.py index f60432cf..2e6e87e0 100644 --- a/python/scriptingprovider.py +++ b/python/scriptingprovider.py @@ -621,7 +621,7 @@ class PythonScriptingInstance(ScriptingInstance): def __init__(self, instance): super(PythonScriptingInstance.InterpreterThread, self).__init__() self.instance = instance - # Note: "current_address", "here", "current_comment", "current_selection", and "current_file_offset" are + # Note: "current_address", "here", "current_comment", "current_selection", and "current_raw_offset" are # interactive auto-variables (i.e. can be set by user and programmatically) blacklisted_vars = { "current_thread", @@ -795,7 +795,7 @@ from binaryninja import * self.locals["current_address"] = self.active_addr self.locals["here"] = self.active_addr self.locals["current_selection"] = (self.active_selection_begin, self.active_selection_end) - self.locals["current_file_offset"] = self.active_file_offset + self.locals["current_raw_offset"] = self.active_file_offset self.locals["dbg"] = self.active_dbg if self.active_func is None: self.locals["current_llil"] = None @@ -921,18 +921,18 @@ from binaryninja import * lambda: self.locals["current_ui_context"].navigateForBinaryView( self.active_view, self.locals["current_address"])) - def update_current_file_offset(self): + def update_current_raw_offset(self): tryNavigate = True - if isinstance(self.locals["current_file_offset"], str): + if isinstance(self.locals["current_raw_offset"], str): try: - self.locals["current_file_offset"] =\ - self.active_view.parse_expression(self.locals["current_file_offset"], self.active_addr) + self.locals["current_raw_offset"] =\ + self.active_view.parse_expression(self.locals["current_raw_offset"], self.active_addr) except ValueError as e: sys.stderr.write(str(e) + '\n') tryNavigate = False if tryNavigate: - if self.locals["current_file_offset"] != self.active_file_offset: - addr = self.active_view.get_address_for_data_offset(self.locals["current_file_offset"]) + if self.locals["current_raw_offset"] != self.active_file_offset: + addr = self.active_view.get_address_for_data_offset(self.locals["current_raw_offset"]) if addr is not None: if not self.active_view.file.navigate(self.active_view.file.view, addr): binaryninja.mainthread.execute_on_main_thread( @@ -988,7 +988,7 @@ from binaryninja import * def apply_locals(self): self.update_here() - self.update_current_file_offset() + self.update_current_raw_offset() self.update_current_comment() self.update_current_selection() -- cgit v1.3.1