def initialize_ui(): widget.register_dockwidget(BreakpointsWidget.DebugBreakpointsWidget, "Breakpoints", Qt.BottomDockWidgetArea, Qt.Horizontal, False) widget.register_dockwidget(RegistersWidget.DebugRegistersWidget, "Registers", Qt.RightDockWidgetArea, Qt.Vertical, False) widget.register_dockwidget(ThreadsWidget.DebugThreadsWidget, "Threads", Qt.BottomDockWidgetArea, Qt.Horizontal, False) widget.register_dockwidget(StackWidget.DebugStackWidget, "Stack", Qt.LeftDockWidgetArea, Qt.Vertical, False) widget.register_dockwidget(ModulesWidget.DebugModulesWidget, "Modules", Qt.BottomDockWidgetArea, Qt.Horizontal, False) # TODO: Needs adapter support # widget.register_dockwidget(ConsoleWidget.DebugConsoleWidget, "Debugger Console", Qt.BottomDockWidgetArea, Qt.Horizontal, False) PluginCommand.register_for_address( "Set Breakpoint", "sets breakpoint at right-clicked address", cb_bp_set, is_valid=require_adapter) PluginCommand.register_for_address( "Clear Breakpoint", "clears breakpoint at right-clicked address", cb_bp_clr, is_valid=require_adapter) ViewType.registerViewType(DebugView.DebugViewType())
def initialize_ui(): widget.register_dockwidget(BreakpointsWidget.DebugBreakpointsWidget, "Debugger Breakpoints", Qt.BottomDockWidgetArea, Qt.Horizontal, False) widget.register_dockwidget(RegistersWidget.DebugRegistersWidget, "Debugger Registers", Qt.RightDockWidgetArea, Qt.Vertical, False) widget.register_dockwidget(ThreadsWidget.DebugThreadsWidget, "Debugger Threads", Qt.BottomDockWidgetArea, Qt.Horizontal, False) widget.register_dockwidget(StackWidget.DebugStackWidget, "Debugger Stack", Qt.LeftDockWidgetArea, Qt.Vertical, False) widget.register_dockwidget(ModulesWidget.DebugModulesWidget, "Debugger Modules", Qt.BottomDockWidgetArea, Qt.Horizontal, False) widget.register_dockwidget(ConsoleWidget.DebugConsoleWidget, "Debugger Console", Qt.BottomDockWidgetArea, Qt.Horizontal, False) PluginCommand.register_for_address("Debugger\\Toggle Breakpoint", "sets/clears breakpoint at right-clicked address", cb_bp_toggle, is_valid=valid_bp_toggle) PluginCommand.register("Debugger\\Process\\Run", "Start new debugging session", cb_process_run, is_valid=valid_process_run) PluginCommand.register("Debugger\\Process\\Restart", "Restart debugging session", cb_process_restart, is_valid=valid_process_restart) PluginCommand.register("Debugger\\Process\\Quit", "Terminate debugged process and end session", cb_process_quit, is_valid=valid_process_quit) # PluginCommand.register("Debugger\\Process\\Attach", "Attach to running process", cb_process_attach, is_valid=valid_process_attach) PluginCommand.register("Debugger\\Process\\Detach", "Detach from current debugged process", cb_process_detach, is_valid=valid_process_detach) PluginCommand.register("Debugger\\Process\\Settings", "Open adapter settings menu", cb_process_settings, is_valid=valid_process_settings) PluginCommand.register("Debugger\\Control\\Pause", "Pause execution", cb_control_pause, is_valid=valid_control_pause) PluginCommand.register("Debugger\\Control\\Resume", "Resume execution", cb_control_resume, is_valid=valid_control_resume) PluginCommand.register("Debugger\\Control\\Step Into (Assembly)", "Step into assembly", cb_control_step_into_asm, is_valid=valid_control_step_into_asm) PluginCommand.register("Debugger\\Control\\Step Into (IL)", "Step into IL", cb_control_step_into_il, is_valid=valid_control_step_into_il) PluginCommand.register("Debugger\\Control\\Step Over (Assembly)", "Step over function call", cb_control_step_over_asm, is_valid=valid_control_step_over_asm) PluginCommand.register("Debugger\\Control\\Step Over (IL)", "Step over function call", cb_control_step_over_il, is_valid=valid_control_step_over_il) PluginCommand.register("Debugger\\Control\\Step Return", "Step until current function returns", cb_control_step_return, is_valid=valid_control_step_return) ViewType.registerViewType(DebugView.DebugViewType())
__all__ = ['linear_mlil'] from . import mlil_ast try: from binaryninjaui import ViewType from .linear_mlil import LinearMLILViewType # ViewType.registerViewType(MlilLinearViewType()) # Register the view type so that it can be chosen by the user ViewType.registerViewType(LinearMLILViewType()) except ImportError as e: print(f"Import Error {e}")
# executable means the view is mapped like an OS loader would load an executable (eg: view=ELF) # !executable means executable image is not mapped (eg: view=Raw) (or something like .png is loaded) if binaryView.executable: return 0 if binaryView.start != 0: return 1 dataSample = binaryView.read(0, 16) if len(dataSample) != 16: return 1 # if we don't recognize it, return 0 ksModuleName = kshelpers.idData(dataSample, len(binaryView)) if not ksModuleName: return 1 # for executables, yield to triage (25) if ksModuleName in ['elf', 'microsoft_pe', 'mach_o']: return 24 # return 100 def create(self, binaryView, view_frame): return KaitaiView(view_frame, binaryView) ViewType.registerViewType(KaitaiViewType())
return 25 return 1 return 0 def create(self, data, view_frame): return TriageView(view_frame, data) Settings().register_group("triage", "Triage") Settings().register_setting( "triage.preferSummaryView", """ { "title" : "Prefer Triage Summary View", "type" : "boolean", "default" : false, "description" : "Always prefer Triage Summary View when opening a binary, even when performing full analysis." } """) Settings().register_setting( "triage.preferSummaryViewForRaw", """ { "title" : "Prefer Triage Summary View for Raw Files", "type" : "boolean", "default" : false, "description" : "Prefer Triage Summary View when opening a binary that is Raw file type." } """) ViewType.registerViewType(TriageViewType())
return render = self.createRenderContext() x = (event.x() - 2) // render.getFontWidth() - (self.addrWidth + 2) y = (event.y() - 2) // render.getFontHeight() if (x == self.lastMouseX) and (y == self.lastMouseY): return self.lastMouseX = x self.lastMouseY = y self.cursorAddr = self.addressFromLocation(x, y) self.repositionCaret() self.viewport().update() def mouseReleaseEvent(self, event): if event.button() != Qt.LeftButton: return self.leftButtonDown = False class ByteViewType(ViewType): def __init__(self): super(ByteViewType, self).__init__("Bytes", "Byte Overview") def getPriority(self, data, filename): return 1 def create(self, data, view_frame): return ByteView(view_frame, data) ViewType.registerViewType(ByteViewType())
if func == self.function: # Address is within current function, go directly there self.showAddress(addr, True) return True # Navigate to the correct function self.function = func graph = DisassemblyAndLowLevelILGraph(func) self.setGraph(graph, addr) return True # View type for the new view class DisassemblyAndLowLevelILViewType(ViewType): def __init__(self): super(DisassemblyAndLowLevelILViewType, self).__init__("Asm -> LLIL", "Assembly to Low Level IL") def getPriority(self, data, filename): if data.executable: # Use low priority so that this view is not picked by default return 1 return 0 def create(self, data, view_frame): return DisassemblyAndLowLevelILView(view_frame, data) # Register the view type so that it can be chosen by the user ViewType.registerViewType(DisassemblyAndLowLevelILViewType())
#print("func not in graph") # Moving to new function, empty everything self.function = func self.graph_funcs = [func] for i in self.proximity_map[func]: self.graph_funcs.append(i) self.graph_edges = {func: self.proximity_map[func]} newgraph = ProximityGraph(self.graph_funcs, self.graph_edges) self.graph = newgraph self.setGraph(self.graph, addr) return True class ProximityViewType(ViewType): def __init__(self): super(ProximityViewType, self).__init__("Proximity View", "Proximity") def getPriority(self, data, filename): if data.executable: # Use low priority so that this view is not picked by default return 1 return 0 def create(self, data, view_frame): return ProximityView(view_frame, data) # Register the view type so that it can be chosen by the user ViewType.registerViewType(ProximityViewType())
def run(self): define_types_plugin(self.view) self.progress = 'Defining Objective-C selectors...' define_selectors_plugin(self.view) self.progress = 'Defining CFStrings...' define_cfstrings_plugin(self.view) self.progress = 'Defining Objective-C classes...' define_classes_plugin(self.view) self.progress = 'Defining Objective-C methods...' define_methods(self.view) def _run_all_plugins(view): if view.session_data.get('ClassList'): return ObjectiveCTaskThread(view).start() PluginCommand.register("Objc\\Run all", "Run all Objective-C plugins", _run_all_plugins, is_valid=lambda v: '__objc_data' in v.sections) ViewType.registerViewType(ObjcFlowGraphViewType())
if hasattr(entry, 'function') and hasattr(entry, 'type_graph'): self.function = entry.function self.simplify = entry.simplify self.dontmodstack = entry.dontmodstack self.loadmemint = entry.loadmemint self.type_graph = entry.type_graph graph = self.get_graph() self.setGraph(graph) super(MiasmIRGraphView, self).navigateToHistoryEntry(entry) def getStatusBarWidget(self): return MiasmStatusBarWidget(self) class MiasmIRGraphViewType(ViewType): def __init__(self, do_simplify=False, do_ssa=False, do_ssaunssa=False): super(MiasmIRGraphViewType, self).__init__("Miasm IR Graph", "Miasm IR Graph") def getPriority(self, data, filename): if data.executable: return 1 return 0 def create(self, data, view_frame): return MiasmIRGraphView(view_frame, data) ViewType.registerViewType(MiasmIRGraphViewType())
def __init__(self): ViewType.__init__(self, "Call Graph", "Call Graph View")
#print("getData()") return self.binaryViewY # filled in status bar "Selection: 0xd3 to 0xe4 (0x11 bytes)" def getCurrentOffset(self): return self.hexWidget.getCurrentOffset() def getSelectionOffsets(self): return self.hexWidget.getSelectionOffsets() def setCurrentOffset(self, offset): return self.hexWidget.setCurrentOffset() # navigate() called when feature map clicked def navigate(self, addr): return self.hexWidget.navigate(addr) class Rot13ViewType(ViewType): def __init__(self): super(Rot13ViewType, self).__init__("Rot13", "Rot13") def getPriority(self, binaryView, filename): return 100 if filename.endswith('.rot13') else 1 def create(self, binaryView, view_frame): return Rot13View(view_frame, binaryView) ViewType.registerViewType(Rot13ViewType())
from .types.make_struct import make_struct_here from .functions.callgraph import CallGraphViewType UIAction.registerAction( "Reverse Engineer's Toolkit\\Types\\Export Type Library") UIActionHandler.globalActions().bindAction( "Reverse Engineer's Toolkit\\Types\\Export Type Library", UIAction(export_type_library, lambda ctx: ctx.binaryView is not None), ) Menu.mainMenu("Tools").addAction( "Reverse Engineer's Toolkit\\Types\\Export Type Library", "Export Type Library") UIAction.registerAction( "Reverse Engineer's Toolkit\\Types\\Import Type Library") UIActionHandler.globalActions().bindAction( "Reverse Engineer's Toolkit\\Types\\Import Type Library", UIAction(browse_type_library, lambda ctx: ctx.binaryView is not None), ) Menu.mainMenu("Tools").addAction( "Reverse Engineer's Toolkit\\Types\\Import Type Library", "Import Type Library") PluginCommand.register_for_range( "Make Structure Here", "Make a structure from this range of data variables", make_struct_here, ) ViewType.registerViewType(CallGraphViewType())