explorer: fix plugin exception when loaded under idat (#1341)

This commit is contained in:
Mike Hunhoff
2023-03-02 13:42:43 -07:00
committed by GitHub
parent 52de09a032
commit 9f3428e1c3
4 changed files with 13 additions and 8 deletions

View File

@@ -25,6 +25,7 @@
### Bug Fixes ### Bug Fixes
- extractor: fix vivisect loop detection corner case #1310 @mr-tz - extractor: fix vivisect loop detection corner case #1310 @mr-tz
- match: extend OS characteristic to match OS_ANY to all supported OSes #1324 @mike-hunhoff - match: extend OS characteristic to match OS_ANY to all supported OSes #1324 @mike-hunhoff
- explorer: fix exception when plugin loaded in IDA hosted under idat #1341 @mike-hunhoff
- extractor: fix IDA and vivisect string and bytes features overlap and tests #1327 #1336 @xusheng6 - extractor: fix IDA and vivisect string and bytes features overlap and tests #1327 #1336 @xusheng6
### capa explorer IDA Pro plugin ### capa explorer IDA Pro plugin

View File

@@ -38,6 +38,12 @@ class CapaExplorerPlugin(idaapi.plugin_t):
"""called when IDA is loading the plugin""" """called when IDA is loading the plugin"""
logging.basicConfig(level=logging.INFO) logging.basicConfig(level=logging.INFO)
# do not load plugin unless hosted in idaq (IDA Qt)
if not idaapi.is_idaq():
# note: it does not appear that IDA calls "init" by default when hosted in idat; we keep this
# check here for good measure
return idaapi.PLUGIN_SKIP
import capa.ida.helpers import capa.ida.helpers
# do not load plugin if IDA version/file type not supported # do not load plugin if IDA version/file type not supported

View File

@@ -29,7 +29,7 @@ import capa.features.extractors.ida.extractor
from capa.rules import Rule from capa.rules import Rule
from capa.engine import FeatureSet from capa.engine import FeatureSet
from capa.rules.cache import compute_ruleset_cache_identifier from capa.rules.cache import compute_ruleset_cache_identifier
from capa.ida.plugin.icon import QICON from capa.ida.plugin.icon import ICON
from capa.ida.plugin.view import ( from capa.ida.plugin.view import (
CapaExplorerQtreeView, CapaExplorerQtreeView,
CapaExplorerRulegenEditor, CapaExplorerRulegenEditor,
@@ -238,7 +238,11 @@ class CapaExplorerForm(idaapi.PluginForm):
load interface and install hooks but do not analyze database load interface and install hooks but do not analyze database
""" """
self.parent = self.FormToPyQtWidget(form) self.parent = self.FormToPyQtWidget(form)
self.parent.setWindowIcon(QICON)
pixmap = QtGui.QPixmap()
pixmap.loadFromData(ICON)
self.parent.setWindowIcon(QtGui.QIcon(pixmap))
self.load_interface() self.load_interface()
self.load_ida_hooks() self.load_ida_hooks()

File diff suppressed because one or more lines are too long