From 62a0dc4bb62beb1b9de00cbb410ff9466383efe8 Mon Sep 17 00:00:00 2001 From: Michael Hunhoff Date: Wed, 1 Jul 2020 07:58:54 -0600 Subject: [PATCH] fixing supscope display --- capa/ida/explorer/item.py | 9 ++++----- capa/ida/explorer/model.py | 4 ++-- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/capa/ida/explorer/item.py b/capa/ida/explorer/item.py index 0d770722..729faa4a 100644 --- a/capa/ida/explorer/item.py +++ b/capa/ida/explorer/item.py @@ -206,7 +206,7 @@ class CapaExplorerDefaultItem(CapaExplorerDataItem): class CapaExplorerFeatureItem(CapaExplorerDataItem): """ store data relevant to capa feature result """ - def __init__(self, parent, display='', location='', details=''): + def __init__(self, parent, display, location='', details=''): location = location_to_hex(location) if location else '' super(CapaExplorerFeatureItem, self).__init__(parent, [display, location, details]) @@ -216,8 +216,7 @@ class CapaExplorerInstructionViewItem(CapaExplorerFeatureItem): def __init__(self, parent, display, location): """ """ details = capa.ida.helpers.get_disasm_line(location) - super(CapaExplorerInstructionViewItem, self).__init__(parent, display=display, - location=location, details=details) + super(CapaExplorerInstructionViewItem, self).__init__(parent, display, location=location, details=details) self.ida_highlight = idc.get_color(location, idc.CIC_ITEM) @@ -236,7 +235,7 @@ class CapaExplorerByteViewItem(CapaExplorerFeatureItem): else: details = '' - super(CapaExplorerByteViewItem, self).__init__(parent, display=display, location=location, details=details) + super(CapaExplorerByteViewItem, self).__init__(parent, display, location=location, details=details) self.ida_highlight = idc.get_color(location, idc.CIC_ITEM) @@ -244,5 +243,5 @@ class CapaExplorerStringViewItem(CapaExplorerFeatureItem): def __init__(self, parent, display, location): """ """ - super(CapaExplorerStringViewItem, self).__init__(parent, display=display, location=location) + super(CapaExplorerStringViewItem, self).__init__(parent, display, location=location) self.ida_highlight = idc.get_color(location, idc.CIC_ITEM) diff --git a/capa/ida/explorer/model.py b/capa/ida/explorer/model.py index 34a1a796..7b3b21c7 100644 --- a/capa/ida/explorer/model.py +++ b/capa/ida/explorer/model.py @@ -334,7 +334,7 @@ class CapaExplorerDataModel(QtCore.QAbstractItemModel): return CapaExplorerFeatureItem(parent, display=display) elif statement['type'] == 'subscope': - return CapaExplorerDefaultItem(parent, statement['subscope']) + return CapaExplorerFeatureItem(parent, 'subscope(%s)' % statement['subscope']) elif statement['type'] == 'regex': # regex is a `Statement` not a `Feature` # this is because it doesn't get extracted, but applies to all strings in scope. @@ -466,7 +466,7 @@ class CapaExplorerDataModel(QtCore.QAbstractItemModel): parent2 = self.render_capa_doc_feature(parent, feature, next(iter(locations)), doc, display=display) else: # feature has multiple children, nest under one parent feature node - parent2 = CapaExplorerFeatureItem(parent, display=display) + parent2 = CapaExplorerFeatureItem(parent, display) for location in sorted(locations): self.render_capa_doc_feature(parent2, feature, location, doc)