From 1cee93005585344d37b513eceb0b961323669993 Mon Sep 17 00:00:00 2001 From: Michael Hunhoff Date: Thu, 10 Sep 2020 17:19:52 -0600 Subject: [PATCH] highlight regex in IDA ui --- capa/ida/plugin/item.py | 4 ++-- capa/ida/plugin/model.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/capa/ida/plugin/item.py b/capa/ida/plugin/item.py index b63886fc..6cf24267 100644 --- a/capa/ida/plugin/item.py +++ b/capa/ida/plugin/item.py @@ -341,12 +341,12 @@ class CapaExplorerByteViewItem(CapaExplorerFeatureItem): class CapaExplorerStringViewItem(CapaExplorerFeatureItem): """store data for string match""" - def __init__(self, parent, display, location): + def __init__(self, parent, display, location, value): """initialize item @param parent: parent node @param display: text to display in UI @param location: virtual address as seen by IDA """ - super(CapaExplorerStringViewItem, self).__init__(parent, display, location=location) + super(CapaExplorerStringViewItem, self).__init__(parent, display, location=location, details=value) self.ida_highlight = idc.get_color(location, idc.CIC_ITEM) diff --git a/capa/ida/plugin/model.py b/capa/ida/plugin/model.py index 4626a01d..e95e6b9a 100644 --- a/capa/ida/plugin/model.py +++ b/capa/ida/plugin/model.py @@ -522,7 +522,7 @@ class CapaExplorerDataModel(QtCore.QAbstractItemModel): ) if feature["type"] == "regex": - return CapaExplorerFeatureItem(parent, display, location, details=feature["match"]) + return CapaExplorerStringViewItem(parent, display, location, feature["match"]) if feature["type"] == "basicblock": return CapaExplorerBlockItem(parent, location) @@ -547,7 +547,7 @@ class CapaExplorerDataModel(QtCore.QAbstractItemModel): if feature["type"] in ("string",): # display string preview - return CapaExplorerStringViewItem(parent, display, location) + return CapaExplorerStringViewItem(parent, display, location, feature[feature["type"]]) if feature["type"] in ("import", "export"): # display no preview