diff --git a/CHANGELOG.md b/CHANGELOG.md index 443de56b0..543db9ac2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,7 @@ ### Bug Fixes - 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 +- 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 ### capa explorer IDA Pro plugin diff --git a/capa/ida/plugin/__init__.py b/capa/ida/plugin/__init__.py index 7ccb8acf6..8030a8003 100644 --- a/capa/ida/plugin/__init__.py +++ b/capa/ida/plugin/__init__.py @@ -38,6 +38,12 @@ def init(self): """called when IDA is loading the plugin""" 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 # do not load plugin if IDA version/file type not supported diff --git a/capa/ida/plugin/form.py b/capa/ida/plugin/form.py index 1a7a2ef14..2f30928d6 100644 --- a/capa/ida/plugin/form.py +++ b/capa/ida/plugin/form.py @@ -29,7 +29,7 @@ from capa.rules import Rule from capa.engine import FeatureSet 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 ( CapaExplorerQtreeView, CapaExplorerRulegenEditor, @@ -238,7 +238,11 @@ def OnCreate(self, form): load interface and install hooks but do not analyze database """ 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_ida_hooks() diff --git a/capa/ida/plugin/icon.py b/capa/ida/plugin/icon.py index fcda46dbe..76a6dfb2c 100644 --- a/capa/ida/plugin/icon.py +++ b/capa/ida/plugin/icon.py @@ -1,13 +1,7 @@ import base64 -from PyQt5 import QtGui - # this is just `capa/.github/icon.png`. # embed it in source so we don't have to figure out how to package into pypi release. ICON = base64.b64decode( "iVBORw0KGgoAAAANSUhEUgAAAIcAAACJCAYAAAAG7St6AAAACXBIWXMAAAsSAAALEgHS3X78AAAZYklEQVR4nO1de3gUVZY/HR4hMQkhoAhBeYgxOCNE2SE4LBJeDg/XgI9lnI0Q9RNnQhTizI6Ku7PO+ELX/dAx5g+HccDJrs6qEFTQGVGiuOPA6CA4StugBAjykEceEAya9H6/SlWoVN+qurfura4G+/d9fqa7q6uLrl+fc+45v3NuKBqNUhJJsJCS/FaSsEOSHEnYIkmOJGyRJEcStkiSIwlbJMnBgbzKcHbCX6QPSC5lHZBXGS4lot/pRzQS0aJIef7yhLxYH3BGkcN0M1cQ0X2R8vw6iXMNIaKdlqebIuX5veWv9PTAGeNW8irDRaZf+Tzc2LzK8CyJUz7OeC5rcdXK5qVV1aUS5z1tcCbFHPdZn+hO7X+Y+dSfZ4ieKK8yDNdRzHrto2j/DBvinHE4I9yKHjAetXt9AB37wz7K+HGkPL/B5TxF+o0f5XTc9SmfUD9qubSirORDmetOdHQ/Q/4dju5jH2XMCVF0Zl5l+CUiqiGihkh5fq0eV+C/Iv0cjqQwsLr9IvpB6LNfEdHVKv8RiYbT3nLoVgO/4MHx/Nye1EZDQg23vrpg3DLe9+RVhu/TiTgBHIuU58vERL7jTCBHjTk+yM3qQfeO70/bvvyKntx0yPfPP4u+fuU49fhFpDzf1sU4uKuJsGC+X6RHnLbk0C1GTOD4yJQBNFtfbYYPtdLVz1tXo+4Y0a8X3Tv+HO24BzccpG2HvuJ52xYiwo2u0y2Z4bJs3dXQUANNC+1YXVFWkpAWJHBy6KYWNxrBYh1Pkkn/JS5nuZIP5udRZs9Ti7BV4Ua6a90+7usBMaqvOb/zHHubv6bi5+uoqbVN4F/Fh4HUTMUpn+LYiRVlJQlnQQINSPWA8D8szyGH8HikPL+GcSxIUar77Bj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