예제 #1
0
    def parseDirEntries(self):
        if len(self.entries):
            # directory entries already built
            return

        # combine all sectors first.
        bytes = ""
        for secID in self.sectorIDs:
            pos = globals.getSectorPos(secID, self.sectorSize)
            bytes += self.bytes[pos : pos + self.sectorSize]

        self.entries = []

        # each directory entry is exactly 128 bytes.
        numEntries = int(len(bytes) / 128)
        if numEntries == 0:
            return
        for i in xrange(0, numEntries):
            pos = i * 128
            self.entries.append(self.parseDirEntry(bytes[pos : pos + 128]))
예제 #2
0
    def parseDirEntries(self):
        if len(self.entries):
            # directory entries already built
            return

        # combine all sectors first.
        bytes = ""
        for secID in self.sectorIDs:
            pos = globals.getSectorPos(secID, self.sectorSize)
            bytes += self.bytes[pos:pos + self.sectorSize]

        self.entries = []

        # each directory entry is exactly 128 bytes.
        numEntries = int(len(bytes) / 128)
        if numEntries == 0:
            return
        for i in xrange(0, numEntries):
            pos = i * 128
            self.entries.append(self.parseDirEntry(bytes[pos:pos + 128]))
예제 #3
0
    def output(self, debug=False):
        print("")
        print("=" * 68)
        print("Directory")

        if debug:
            print("-" * 68)
            print("sector(s) used:")
            for secID in self.sectorIDs:
                print("  sector %d" % secID)

            print("")
            for secID in self.sectorIDs:
                print("-" * 68)
                print("  Raw Hex Dump (sector %d)" % secID)
                print("-" * 68)
                pos = globals.getSectorPos(secID, self.sectorSize)
                globals.dumpBytes(self.bytes[pos : pos + self.sectorSize], 128)

        for entry in self.entries:
            self.__outputEntry(entry, debug)
예제 #4
0
    def output(self, debug=False):
        print('')
        print("=" * globals.OutputWidth)
        print("Directory")

        if debug:
            print("-" * globals.OutputWidth)
            print("sector(s) used:")
            for secID in self.sectorIDs:
                print("  sector %d" % secID)

            print("")
            for secID in self.sectorIDs:
                print("-" * globals.OutputWidth)
                print("  Raw Hex Dump (sector %d)" % secID)
                print("-" * globals.OutputWidth)
                pos = globals.getSectorPos(secID, self.sectorSize)
                globals.dumpBytes(self.bytes[pos:pos + self.sectorSize], 128)

        for entry in self.entries:
            self.__outputEntry(entry, debug)