MCPcopy Create free account
hub / github.com/Vector35/binaryninja-api / GenericExportsModel

Class GenericExportsModel

python/examples/triage/exports.py:8–104  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6
7
8class GenericExportsModel(QAbstractItemModel):
9 def __init__(self, data):
10 super(GenericExportsModel, self).__init__()
11 self.allEntries = []
12 self.addr_col = 0
13 self.name_col = 1
14 self.ordinal_col = None
15 self.total_cols = 2
16 self.sortCol = 0
17 self.sortOrder = Qt.AscendingOrder
18 for sym in data.get_symbols_of_type(SymbolType.FunctionSymbol):
19 if sym.binding == SymbolBinding.GlobalBinding:
20 self.allEntries.append(sym)
21 for sym in data.get_symbols_of_type(SymbolType.DataSymbol):
22 if sym.binding == SymbolBinding.GlobalBinding:
23 self.allEntries.append(sym)
24 if data.view_type == "PE":
25 self.ordinal_col = 0
26 self.addr_col = 1
27 self.name_col = 2
28 self.total_cols = 3
29 self.entries = list(self.allEntries)
30
31 def columnCount(self, parent):
32 return self.total_cols
33
34 def rowCount(self, parent):
35 if parent.isValid():
36 return 0
37 return len(self.entries)
38
39 def data(self, index, role):
40 if role != Qt.DisplayRole:
41 return None
42 if index.row() >= len(self.entries):
43 return None
44 if index.column() == self.addr_col:
45 return "0x%x" % self.entries[index.row()].address
46 if index.column() == self.name_col:
47 return self.entries[index.row()].full_name
48 if index.column() == self.ordinal_col:
49 return str(self.entries[index.row()].ordinal)
50 return None
51
52 def headerData(self, section, orientation, role):
53 if orientation == Qt.Vertical:
54 return None
55 if role != Qt.DisplayRole:
56 return None
57 if section == self.addr_col:
58 return "Address"
59 if section == self.name_col:
60 return "Name"
61 if section == self.ordinal_col:
62 return "Ordinal"
63 return None
64
65 def index(self, row, col, parent):

Callers 1

__init__Method · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected