mirror of
https://github.com/mandiant/capa.git
synced 2025-12-22 23:26:21 -08:00
adding new item type for subscope to help render
This commit is contained in:
@@ -184,6 +184,14 @@ class CapaExplorerFunctionItem(CapaExplorerDataItem):
|
|||||||
self._data[0] = self.fmt % display
|
self._data[0] = self.fmt % display
|
||||||
|
|
||||||
|
|
||||||
|
class CapaExplorerSubscopeItem(CapaExplorerDataItem):
|
||||||
|
|
||||||
|
fmt = 'subscope(%s)'
|
||||||
|
|
||||||
|
def __init__(self, parent, scope):
|
||||||
|
super(CapaExplorerSubscopeItem, self).__init__(parent, [self.fmt % scope, '', ''])
|
||||||
|
|
||||||
|
|
||||||
class CapaExplorerBlockItem(CapaExplorerDataItem):
|
class CapaExplorerBlockItem(CapaExplorerDataItem):
|
||||||
""" store data relevant to capa basic block result """
|
""" store data relevant to capa basic block result """
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,8 @@ from capa.ida.explorer.item import (
|
|||||||
CapaExplorerByteViewItem,
|
CapaExplorerByteViewItem,
|
||||||
CapaExplorerBlockItem,
|
CapaExplorerBlockItem,
|
||||||
CapaExplorerRuleMatchItem,
|
CapaExplorerRuleMatchItem,
|
||||||
CapaExplorerFeatureItem
|
CapaExplorerFeatureItem,
|
||||||
|
CapaExplorerSubscopeItem
|
||||||
)
|
)
|
||||||
|
|
||||||
import capa.ida.helpers
|
import capa.ida.helpers
|
||||||
@@ -105,7 +106,7 @@ class CapaExplorerDataModel(QtCore.QAbstractItemModel):
|
|||||||
|
|
||||||
if role == QtCore.Qt.FontRole and isinstance(item, (CapaExplorerRuleItem, CapaExplorerRuleMatchItem,
|
if role == QtCore.Qt.FontRole and isinstance(item, (CapaExplorerRuleItem, CapaExplorerRuleMatchItem,
|
||||||
CapaExplorerBlockItem, CapaExplorerFunctionItem,
|
CapaExplorerBlockItem, CapaExplorerFunctionItem,
|
||||||
CapaExplorerFeatureItem)) and \
|
CapaExplorerFeatureItem, CapaExplorerSubscopeItem)) and \
|
||||||
column == CapaExplorerDataModel.COLUMN_INDEX_RULE_INFORMATION:
|
column == CapaExplorerDataModel.COLUMN_INDEX_RULE_INFORMATION:
|
||||||
# set bold font for top-level rules
|
# set bold font for top-level rules
|
||||||
font = QtGui.QFont()
|
font = QtGui.QFont()
|
||||||
@@ -334,7 +335,7 @@ class CapaExplorerDataModel(QtCore.QAbstractItemModel):
|
|||||||
|
|
||||||
return CapaExplorerFeatureItem(parent, display=display)
|
return CapaExplorerFeatureItem(parent, display=display)
|
||||||
elif statement['type'] == 'subscope':
|
elif statement['type'] == 'subscope':
|
||||||
return CapaExplorerFeatureItem(parent, 'subscope(%s)' % statement['subscope'])
|
return CapaExplorerSubscopeItem(parent, statement['subscope'])
|
||||||
elif statement['type'] == 'regex':
|
elif statement['type'] == 'regex':
|
||||||
# regex is a `Statement` not a `Feature`
|
# regex is a `Statement` not a `Feature`
|
||||||
# this is because it doesn't get extracted, but applies to all strings in scope.
|
# this is because it doesn't get extracted, but applies to all strings in scope.
|
||||||
|
|||||||
Reference in New Issue
Block a user