From b0e1de7d3dae3844e4dfff45ad2d6d7dfb6fa651 Mon Sep 17 00:00:00 2001 From: Josh Ferrell Date: Sun, 22 Jan 2023 14:12:04 -0500 Subject: Add current_*_ssa to python console, fix #3661 --- python/scriptingprovider.py | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) (limited to 'python/scriptingprovider.py') diff --git a/python/scriptingprovider.py b/python/scriptingprovider.py index 5bc030a2..f18020b9 100644 --- a/python/scriptingprovider.py +++ b/python/scriptingprovider.py @@ -801,10 +801,23 @@ from binaryninja import * self.locals["current_llil"] = None self.locals["current_mlil"] = None self.locals["current_hlil"] = None + self.locals["current_llil_ssa"] = None + self.locals["current_mlil_ssa"] = None + self.locals["current_hlil_ssa"] = None else: - self.locals["current_llil"] = self.active_func.llil_if_available - self.locals["current_mlil"] = self.active_func.mlil_if_available - self.locals["current_hlil"] = self.active_func.hlil_if_available + current_llil = self.active_func.llil_if_available + current_mlil = self.active_func.mlil_if_available + current_hlil = self.active_func.hlil_if_available + self.locals["current_llil"] = current_llil + self.locals["current_mlil"] = current_mlil + self.locals["current_hlil"] = current_hlil + if current_llil is not None: + self.locals["current_llil_ssa"] = current_llil.ssa_form + if current_mlil is not None: + self.locals["current_mlil_ssa"] = current_mlil.ssa_form + if current_hlil is not None: + self.locals["current_hlil_ssa"] = current_hlil.ssa_form + if self.active_view is not None: self.locals["current_data_var"] = self.active_view.get_data_var_at(self.active_addr) @@ -866,10 +879,16 @@ from binaryninja import * ilType = view_location.getILViewType() if ilType == FunctionGraphType.LowLevelILFunctionGraph: self.active_il_function = self.locals["current_llil"] + elif ilType == FunctionGraphType.LowLevelILSSAFormFunctionGraph: + self.active_il_function = self.locals["current_llil_ssa"] elif ilType == FunctionGraphType.MediumLevelILFunctionGraph: self.active_il_function = self.locals["current_mlil"] + elif ilType == FunctionGraphType.MediumLevelILSSAFormFunctionGraph: + self.active_il_function = self.locals["current_mlil_ssa"] elif ilType == FunctionGraphType.HighLevelILFunctionGraph: self.active_il_function = self.locals["current_hlil"] + elif ilType == FunctionGraphType.HighLevelILSSAFormFunctionGraph: + self.active_il_function = self.locals["current_hlil_ssa"] else: self.active_il_function = None -- cgit v1.3.1