From 67cfb3866c8d7790be77cb3495243595dce011d1 Mon Sep 17 00:00:00 2001 From: Michael Hunhoff Date: Wed, 15 Jul 2020 14:55:29 -0600 Subject: [PATCH] support regex feature capa explorer --- capa/ida/explorer/model.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/capa/ida/explorer/model.py b/capa/ida/explorer/model.py index 27459b09..26e387c5 100644 --- a/capa/ida/explorer/model.py +++ b/capa/ida/explorer/model.py @@ -488,18 +488,15 @@ class CapaExplorerDataModel(QtCore.QAbstractItemModel): } """ display = self.capa_doc_feature_to_display(feature) - details = "" - if feature["type"] == "regex": - details = feature["match"] if len(locations) == 1: # only one location for feature so no need to nest children parent2 = self.render_capa_doc_feature( - parent, feature, next(iter(locations)), doc, display=display, details=details + parent, feature, next(iter(locations)), doc, display=display, ) else: # feature has multiple children, nest under one parent feature node - parent2 = CapaExplorerFeatureItem(parent, display, details=details) + parent2 = CapaExplorerFeatureItem(parent, display) for location in sorted(locations): self.render_capa_doc_feature(parent2, feature, location, doc) @@ -539,6 +536,9 @@ class CapaExplorerDataModel(QtCore.QAbstractItemModel): parent, display, source=doc["rules"].get(feature[feature["type"]], {}).get("source", "") ) + if feature["type"] == "regex": + return CapaExplorerFeatureItem(parent, display, location, details=feature["match"]) + if feature["type"] == "basicblock": return CapaExplorerBlockItem(parent, location)