Ejemplo n.º 1
0
 def __init__(self, entry_type, num_entries=None):
     if num_entries is not None:
         desc = '%s %s' % (commafy(num_entries), entry_type)
     else:
         desc = entry_type
     super(SymbolTableBase, self).__init__('SymbolTable: %s' % desc,
                                           desc=desc)
Ejemplo n.º 2
0
 def data(self, data_row):
     for sect in self._sections:
         if data_row >= sect.num_matched:
             data_row -= sect.num_matched
             continue
         offset, string = sect.string(data_row)
         return commafy(offset), string
     assert False  # should never get here
Ejemplo n.º 3
0
 def data(self, data_row):
     for sect in self._sections:
         if data_row >= sect.num_matched:
             data_row -= sect.num_matched
             continue
         offset, string = sect.string(data_row)
         return commafy(offset), string
     assert False  # should never get here
Ejemplo n.º 4
0
    def display(self):
        filter_pattern = self.search_entry.get()

        # Update Mach-O table
        self._filter_mapping = list()
        for (mach_o_idx, mach_o_info) in enumerate(self._mach_o_info):
            # TODO - Add graphical progress indicator as this operation can be time consuming
            num_matches = mach_o_info.filter(filter_pattern)
            if num_matches == 0:
                continue
            self.mach_o_table.add(
                '', len(self._filter_mapping),
                (mach_o_info.desc, commafy(mach_o_info.num_symbols()),
                 commafy(mach_o_info.num_matched)))
            self._filter_mapping.append(mach_o_idx)

        # Update symbol table
        if len(self._filter_mapping) > 0:
            self.mach_o_table.tree.selection_set('.0')
Ejemplo n.º 5
0
    def display(self):
        filter_pattern = self.search_entry.get()

        # Update Mach-O table
        self._filter_mapping = dict()
        first_matched_id = None
        mach_o_idx = 0
        for mach_o_info in self._mach_o_info:
            # TODO - Add graphical progress indicator as this operation can be time consuming
            num_matches = mach_o_info.filter(filter_pattern)
            if num_matches == 0:
                continue
            mach_o_id = '.' + str(mach_o_idx)
            self.mach_o_table.add('', mach_o_idx,
                                  (mach_o_info.desc, commafy(mach_o_info.offset),
                                   commafy(mach_o_info.num_strings), commafy(mach_o_info.num_matched)))
            mach_o_idx += 1
            if first_matched_id is None:
                first_matched_id = mach_o_id
            self._filter_mapping[mach_o_id] = mach_o_info.string_sections

            section_idx = 0
            for sect_info in mach_o_info.string_sections:
                if sect_info.num_matched == 0:
                    continue
                sect_id = self.mach_o_table.add(mach_o_id, section_idx,
                                                (sect_info.desc, commafy(sect_info.offset),
                                                 commafy(sect_info.num_strings), commafy(sect_info.num_matched)))
                section_idx += 1
                self._filter_mapping[sect_id] = [sect_info]
            self.mach_o_table.tree.item(mach_o_id, open=True)

        # Update symbol table
        if first_matched_id is not None:
            self.mach_o_table.tree.selection_set(first_matched_id)
Ejemplo n.º 6
0
    def display(self):
        filter_pattern = self.search_entry.get()

        # Update Mach-O table
        self._filter_mapping = dict()
        first_matched_id = None
        mach_o_idx = 0
        for mach_o_info in self._mach_o_info:
            # TODO - Add graphical progress indicator as this operation can be time consuming
            num_matches = mach_o_info.filter(filter_pattern)
            if num_matches == 0:
                continue
            mach_o_id = '.' + str(mach_o_idx)
            self.mach_o_table.add(
                '', mach_o_idx, (mach_o_info.desc, commafy(
                    mach_o_info.offset), commafy(mach_o_info.num_strings),
                                 commafy(mach_o_info.num_matched)))
            mach_o_idx += 1
            if first_matched_id is None:
                first_matched_id = mach_o_id
            self._filter_mapping[mach_o_id] = mach_o_info.string_sections

            section_idx = 0
            for sect_info in mach_o_info.string_sections:
                if sect_info.num_matched == 0:
                    continue
                sect_id = self.mach_o_table.add(
                    mach_o_id, section_idx,
                    (sect_info.desc, commafy(
                        sect_info.offset), commafy(sect_info.num_strings),
                     commafy(sect_info.num_matched)))
                section_idx += 1
                self._filter_mapping[sect_id] = [sect_info]
            self.mach_o_table.tree.item(mach_o_id, open=True)

        # Update symbol table
        if first_matched_id is not None:
            self.mach_o_table.tree.selection_set(first_matched_id)
Ejemplo n.º 7
0
 def __init__(self, entry_type, num_entries=None):
     if num_entries is not None:
         desc = '%s %s' % (commafy(num_entries), entry_type)
     else:
         desc = entry_type
     super(SymbolTableBase, self).__init__('SymbolTable: %s' % desc, desc=desc)
Ejemplo n.º 8
0
 def test_commafy(self):
     self.assertEqual('123', commafy(123))
     self.assertEqual('12,345', commafy(12345))
     self.assertEqual('1,234,567', commafy(1234567))
     self.assertEqual('1,234.5678', commafy(1234.5678))