Пример #1
0
 def _format_index_page(page):
     ret = []
     ret.append("<header> logical page: {:s} | physical page: {:s} | count: {:s}".format(
         h(page.logical_page_number),
         h(page.physical_page_number),
         h(page.key_count)))
     for i in xrange(page.key_count):
         key = page.get_key(i)
         ret.append(" | {{ {key:s} | <child_{i:s}> {child:s} }}".format(
             key=key.human_format,
             i=h(i),
             child=h(page.get_child(i))))
     return "".join(ret)
Пример #2
0
    def _graph_index_page_rec(self, page):
        print("  \"node{:s}\" [".format(h(page.logical_page_number)))
        print("     label = \"{:s}\"".format(self._format_index_page(page)))
        print("     shape = \"record\"")
        print("  ];")

        key_count = page.key_count
        for i in xrange(key_count + 1):
            child_page_number = page.get_child(i)
            if not is_index_page_number_valid(child_page_number):
                continue
            child_page = self._cim.logical_index_store.get_page(child_page_number)
            self._graph_index_page_rec(child_page)

        for i in xrange(key_count):
            child_page_number = page.get_child(i)
            if not is_index_page_number_valid(child_page_number):
                continue
            print("  \"node{num:s}\":child_{i:s} -> \"node{child:s}\"".format(
                num=h(page.logical_page_number),
                i=h(i),
                child=h(child_page_number)))
        # last entry has two links, to both less and greater children nodes
        final_child_index = page.get_child(key_count)
        if is_index_page_number_valid(final_child_index):
            print("  \"node{num:s}\":child_{i:s} -> \"node{child:s}\"".format(
                num=h(page.logical_page_number),
                i=h(key_count - 1),
                child=h(final_child_index)))
Пример #3
0
 def structs(self):
     page = self._ctx.cim.logical_data_store.get_page(self.index)
     ret = [
         VstructInstance(0x0, page.toc, "toc"),
     ]
     for i, data in enumerate(page.objects):
         vbuf = v_bytes(size=len(data.buffer))
         vbuf.vsParse(data.buffer)
         ret.append(VstructInstance(data.offset, vbuf, "Object {:s}".format(h(i))))
     return ret
Пример #4
0
    def structs(self):
        page = self._ctx.cim.logical_index_store.get_page(self._page_number)
        ret = [
            VstructInstance(0x0, page, "node"),
        ]

        data_offset = page.vsGetOffset("data")
        for i in range(page.key_count):
            string_part_count = page.string_definition_table[i]

            for j in range(string_part_count):
                string_part_index = page.string_definition_table[i + 1 + j]

                s = v_zstr()
                string_offset = page.string_table[string_part_index]
                s.vsParse(page.data, offset=string_offset)

                ret.append(VstructInstance(data_offset + string_offset, s,
                                           "String {:s}, fragment {:s}".format(h(i), h(j))))

        return ret
Пример #5
0
 def __repr__(self):
     return "LogicalDataPageItem(index: {:s})".format(h(self.index))
Пример #6
0
 def __repr__(self):
     return "PhysicalDataPagesItem(numEntries: {:s})".format(
         h(len(self.children)))
Пример #7
0
 def name(self):
     return "{:s}".format(h(self.index))
Пример #8
0
 def name(self):
     return "Node {:s}".format(h(self._page_number))
Пример #9
0
 def __repr__(self):
     return "IndexNodeItem(pageNumber: {:s})".format(
         h(self._page_number))
Пример #10
0
 def __repr__(self):
     return "LogicalIndexPagesItem(numEntries: {:s})".format(
         h(len(self.children)))
Пример #11
0
 def __repr__(self):
     return "PhysicalIndexPageItem(index: {:s})".format(h(self.index))