From dd147dd040dc4e7cf55e1c70109c57f0ea7d86fc Mon Sep 17 00:00:00 2001 From: Michael Hunhoff Date: Fri, 12 Feb 2021 12:03:48 -0700 Subject: [PATCH] format fixes, strip strings before display --- capa/ida/plugin/form.py | 7 ++----- capa/ida/plugin/view.py | 15 +++++++++------ 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/capa/ida/plugin/form.py b/capa/ida/plugin/form.py index ddb82f44..8d30424c 100644 --- a/capa/ida/plugin/form.py +++ b/capa/ida/plugin/form.py @@ -7,8 +7,8 @@ # See the License for the specific language governing permissions and limitations under the License. import os -import json import copy +import json import logging import itertools import collections @@ -26,9 +26,9 @@ import capa.features.extractors.ida from capa.ida.plugin.icon import QICON from capa.ida.plugin.view import ( CapaExplorerQtreeView, - CapaExplorerRulegenFeatures, CapaExplorerRulgenEditor, CapaExplorerRulgenPreview, + CapaExplorerRulegenFeatures, ) from capa.ida.plugin.hooks import CapaExplorerIdaHooks from capa.ida.plugin.model import CapaExplorerDataModel @@ -407,9 +407,6 @@ class CapaExplorerForm(idaapi.PluginForm): splitter1.addWidget(left) splitter1.addWidget(splitter2) - #layout.addWidget(left, 40) - #layout.addWidget(right, 60) - layout.addWidget(splitter1) tab = QtWidgets.QWidget() diff --git a/capa/ida/plugin/view.py b/capa/ida/plugin/view.py index 23680865..7b630044 100644 --- a/capa/ida/plugin/view.py +++ b/capa/ida/plugin/view.py @@ -5,17 +5,16 @@ # Unless required by applicable law or agreed to in writing, software distributed under the License # is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and limitations under the License. -from collections import Counter import re +from collections import Counter import idc -from PyQt5 import QtCore, QtWidgets, QtGui +from PyQt5 import QtGui, QtCore, QtWidgets -import capa.features.basicblock -import capa.ida.helpers -import capa.engine import capa.rules - +import capa.engine +import capa.ida.helpers +import capa.features.basicblock from capa.ida.plugin.item import CapaExplorerFunctionItem from capa.ida.plugin.model import CapaExplorerDataModel @@ -772,6 +771,10 @@ class CapaExplorerRulegenFeatures(QtWidgets.QTreeWidget): # in the future continue + if isinstance(feature, capa.features.String): + # strip string for display + feature.value = feature.value.strip() + # level 0 if type(feature) not in self.parent_items: self.parent_items[type(feature)] = self.new_parent_node(self, (feature.name.lower(),))