disable lighthouse in binja headless
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
import os
|
||||
import binaryninja
|
||||
|
||||
target = os.path.abspath(os.path.join(
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"..",
|
||||
"testcase",
|
||||
"boombox.exe"
|
||||
))
|
||||
|
||||
print "Opening '%s' headlessly..." % target
|
||||
x = binaryninja.BinaryViewType["PE"].open(target)
|
||||
x.update_analysis_and_wait()
|
||||
print "DONE!"
|
||||
@@ -30,7 +30,7 @@ class DisassemblerAPI(object):
|
||||
def __init__(self):
|
||||
self._waitbox = None
|
||||
|
||||
if QT_AVAILABLE:
|
||||
if not self.headless and QT_AVAILABLE:
|
||||
from ..qt import WaitBox
|
||||
self._waitbox = WaitBox("Please wait...")
|
||||
|
||||
@@ -59,6 +59,13 @@ class DisassemblerAPI(object):
|
||||
"""
|
||||
pass
|
||||
|
||||
@abc.abstractproperty
|
||||
def headless(self):
|
||||
"""
|
||||
Return a bool indicating if the disassembler is running headlessly.
|
||||
"""
|
||||
pass
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# Synchronization Decorators
|
||||
#--------------------------------------------------------------------------
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import os
|
||||
import sys
|
||||
import logging
|
||||
import functools
|
||||
import threading
|
||||
@@ -8,6 +9,27 @@ import binaryninja
|
||||
from binaryninja import PythonScriptingInstance, binaryview
|
||||
from binaryninja.plugin import BackgroundTaskThread
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# External PyQt5 Dependency
|
||||
#------------------------------------------------------------------------------
|
||||
#
|
||||
# amend the Python import path with a Libs folder for additional pip
|
||||
# packages required by Lighthouse (at least on Windows, and maybe macOS)
|
||||
#
|
||||
# TODO/FUTURE: it is kind of dirty that we have to do this here. maybe it
|
||||
# can be moved with a later refactor. in the long run, binary ninja will
|
||||
# ship with PyQt5 bindings in-box.
|
||||
#
|
||||
|
||||
DEPENDENCY_PATH = os.path.join(
|
||||
binaryninja.user_plugin_path,
|
||||
"Lib",
|
||||
"site-packages"
|
||||
)
|
||||
sys.path.append(DEPENDENCY_PATH)
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
from .api import DisassemblerAPI, DockableShim
|
||||
from ..qt import *
|
||||
from ..misc import is_mainthread, not_mainthread
|
||||
@@ -126,6 +148,10 @@ class BinjaAPI(DisassemblerAPI):
|
||||
def version_patch(self):
|
||||
return self._version_patch
|
||||
|
||||
@property
|
||||
def headless(self):
|
||||
return not binaryninja.core_ui_enabled
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# Synchronization Decorators
|
||||
#--------------------------------------------------------------------------
|
||||
|
||||
@@ -98,6 +98,10 @@ class IDAAPI(DisassemblerAPI):
|
||||
def version_patch(self):
|
||||
return self._version_patch
|
||||
|
||||
@property
|
||||
def headless(self):
|
||||
return False
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# Synchronization Decorators
|
||||
#--------------------------------------------------------------------------
|
||||
|
||||
@@ -10,7 +10,11 @@ if not logging_started():
|
||||
|
||||
logger.debug("Resolving disassembler platform for plugin...")
|
||||
|
||||
if disassembler.NAME == "IDA":
|
||||
if disassembler.headless:
|
||||
logger.info("Disassembler '%s' is running headlessly" % disassembler.NAME)
|
||||
logger.info(" - Lighthouse is not supported in headless modes (yet!)")
|
||||
|
||||
elif disassembler.NAME == "IDA":
|
||||
logger.info("Selecting IDA loader...")
|
||||
from lighthouse.ida_loader import *
|
||||
|
||||
|
||||
Reference in New Issue
Block a user