def load(self): """ title = "Switch Jumps" #root = QtGui.QTreeWidgetItem(self, title) comment = COLSTR("; Double-click to follow", SCOLOR_BINPREF) #self.AddLine(comment) comment = COLSTR("; Hover for preview", idc.SCOLOR_BINPREF) #self.AddLine(comment) """ self._switch_tree.clear() self._switch_tree.setColumnCount(2) self._switch_tree.clicked.connect(self.click_tree) self.find_all_switch_jumps() for func in sorted(self._switch_dict.keys()): func_node = qt.qtreewidgetitem()(self._switch_tree) func_node.setText(0, func) func_node.setText(1, "") for item in self._switch_dict[func]: node = qt.qtreewidgetitem()(func_node) addr = item[0] cases = item[1] address_element = "0x%08x" % addr node.setText(0, address_element) node.setText(1, "%04s" % cases) for c in item[2]: cnode = qt.qtreewidgetitem()(node) cnode.setText(0, c[0]) cnode.setText(1, c[2]) return True
def addChildren(self, parentWidget, children): if self.parent.cuckoo_version.startswith("1."): for child in children: node = qt.qtreewidgetitem()(parentWidget) node.setText(0, "{}".format(child['pid'])) node.setText(1, child['name']) self.addChildren(node, child['children']) self._proc_tree.expandItem(node) else: for child in children: node = qt.qtreewidgetitem()(parentWidget) node.setText(0, "{}".format(child['pid'])) node.setText(1, child['process_name']) self.addChildren(node, child['children']) self._proc_tree.expandItem(node)
def loadProcTree(self): self._proc_tree.clear() self._proc_tree.setColumnCount(2) self._proc_tree.setHeaderLabels(("PID", "ProcName")) self._proc_tree.setColumnWidth(0, 100) if self.parent.cuckoo_version.startswith("1."): for process in self.parent.process_tree: node = qt.qtreewidgetitem()(self._proc_tree) node.setText(0, "{}".format(process["pid"])) node.setText(1, process["name"]) self.addChildren(node, process["children"]) self._proc_tree.expandItem(node) else: for process in self.parent.process_tree: node = qt.qtreewidgetitem()(self._proc_tree) node.setText(0, "{}".format(process["pid"])) node.setText(1, process["process_name"]) self.addChildren(node, process["children"]) self._proc_tree.expandItem(node)