Example #1
0
 def createFields(self):
     yield NullBytes(self, "unused", 6)
     yield UInt8(self, "offsetIntSize", "Size (in bytes) of offsets in the offset table")
     yield UInt8(self, "objectRefSize", "Size (in bytes) of object numbers in object references")
     yield UInt64(self, "numObjects", "Number of objects in this file")
     yield UInt64(self, "topObject", "Top-level object reference")
     yield UInt64(self, "offsetTableOffset", "File offset to the offset table")
Example #2
0
    def createFields(self):
        yield Bytes(self, "jump", 3, "Intel x86 jump instruction")
        yield String(self, "name", 8)
        yield BiosParameterBlock(self, "bios", "BIOS parameters")

        yield textHandler(UInt8(self, "physical_drive", "(0x80)"), hexadecimal)
        yield NullBytes(self, "current_head", 1)
        yield textHandler(
            UInt8(self, "ext_boot_sig", "Extended boot signature (0x80)"),
            hexadecimal)
        yield NullBytes(self, "unused", 1)

        yield UInt64(self, "nb_sectors")
        yield UInt64(self, "mft_cluster", "Cluster location of MFT data")
        yield UInt64(self, "mftmirr_cluster",
                     "Cluster location of copy of MFT")
        yield UInt8(self, "cluster_per_mft", "MFT record size in clusters")
        yield NullBytes(self, "reserved[]", 3)
        yield UInt8(self, "cluster_per_index", "Index block size in clusters")
        yield NullBytes(self, "reserved[]", 3)
        yield textHandler(UInt64(self, "serial_number"), hexadecimal)
        yield textHandler(UInt32(self, "checksum", "Boot sector checksum"),
                          hexadecimal)
        yield Bytes(self, "boot_code", 426)
        yield Bytes(self, "mbr_magic", 2,
                    r"Master boot record magic number (\x55\xAA)")
Example #3
0
 def createFields(self):
     yield String(self,
                  "header_id",
                  4,
                  "DataBase Header Markup (\"mhbd\")",
                  charset="ISO-8859-1")
     yield UInt32(self, "header_length", "Header Length")
     yield UInt32(self, "entry_length", "Entry Length")
     yield UInt32(self, "unknown[]")
     yield UInt32(self, "version_number", "Version Number")
     yield UInt32(self, "child_number", "Number of Children")
     yield UInt64(self, "id", "ID for this database")
     yield UInt16(self, "unknown[]")
     yield UInt32(self, "unknown[]")
     yield UInt64(self, "unknown[]")
     yield UInt16(self, "unknown[]")
     yield UInt16(self, "hashing_scheme[]",
                  "Algorithm used to calculate the database hash")
     yield NullBytes(self, "unknown[]", 20)
     yield String(self, "language_id", 2, "Language ID")
     yield UInt64(self, "persistent_id", "Library Persistent ID")
     yield UInt32(self, "unknown[]")
     yield UInt32(self, "unknown[]")
     yield RawBytes(self, "hash[]", 20)
     yield Int32(self, "timezone_offset[]", "Timezone offset in seconds")
     yield UInt16(self, "unknown[]")
     yield RawBytes(self, "iphone_hash[]", 45)
     size = self["header_length"].value - self.current_size / 8
     if size > 0:
         yield NullBytes(self, "padding", size)
     for i in range(self["child_number"].value):
         yield DataSet(self, "dataset[]")
     padding = self.seekByte(self["entry_length"].value, "entry padding")
     if padding:
         yield padding
Example #4
0
 def createFields(self):
     yield SymbolStringTableOffset(self, "name", "Section name (index into section header string table)")
     yield Enum(textHandler(UInt32(self, "type", "Section type"), hexadecimal), self.TYPE_NAME)
     yield SectionFlags(self, "flags", "Section flags")
     yield textHandler(UInt64(self, "VMA", "Virtual memory address"), hexadecimal)
     yield textHandler(UInt64(self, "LMA", "Logical memory address (offset in file)"), hexadecimal)
     yield textHandler(UInt64(self, "size", "Section size (bytes)"), hexadecimal)
     yield UInt32(self, "link", "Index of a related section")
     yield UInt32(self, "info", "Type-dependent information")
     yield UInt64(self, "addr_align", "Address alignment (bytes)")
     yield UInt64(self, "entry_size", "Size of each entry in section")
Example #5
0
    def createFields(self):
        yield Enum(textHandler(UInt32(self, "type"), hexadecimal), self.ATTR_NAME)
        yield UInt32(self, "size")
        yield UInt8(self, "non_resident", "Non-resident flag")
        yield UInt8(self, "name_length", "Name length in bytes")
        yield UInt16(self, "name_offset", "Name offset")
        yield UInt16(self, "flags")
        yield textHandler(UInt16(self, "attribute_id"), hexadecimal)
        if self['non_resident'].value:
            yield UInt64(self, "runlist_start", "Starting Virtual Cluster Number of the runlist")
            yield UInt64(self, "runlist_stop", "Ending Virtual Cluster Number of the runlist")
            yield UInt16(self, "runlist_offset", "Offset to the runlist")
            yield UInt16(self, "compression_unit", "Compression unit size")
            yield UInt32(self, "unused[]")
            yield UInt64(self, "size_allocated", "Allocated size of the attribute content")
            yield UInt64(self, "size_actual", "Actual size of the attribute content")
            yield UInt64(self, "size_initialized", "Initialized size of the attribute content")

            if self['name_length'].value:
                padding = self.seekByte(self['name_offset'].value)
                if padding:
                    yield padding
                yield String(self, "name", self['name_length'].value * 2, charset="UTF-16-LE")

            padding = self.seekByte(self['runlist_offset'].value)
            if padding:
                yield padding
            yield RunList(self, "runlist")

        else:
            yield UInt32(self, "length_attr", "Length of the Attribute")
            yield UInt16(self, "offset_attr", "Offset of the Attribute")
            yield UInt8(self, "indexed_flag")

            if self['name_length'].value:
                padding = self.seekByte(self['name_offset'].value)
                if padding:
                    yield padding
                yield String(self, "name", self['name_length'].value * 2, charset="UTF-16-LE")

            padding = self.seekByte(self['offset_attr'].value)
            if padding:
                yield padding

            if self._parser:
                yield from self._parser(self)
            else:
                size = self["length_attr"].value
                if size:
                    yield RawBytes(self, "data", size)

        size = (self.size - self.current_size) // 8
        if size:
            yield PaddingBytes(self, "end_padding", size)
Example #6
0
 def createFields(self):
     yield String(self, "segname", 16, strip="\0")
     yield textHandler(UInt64(self, "vmaddr"), hexadecimal)
     yield textHandler(UInt64(self, "vmsize"), hexadecimal)
     yield textHandler(UInt64(self, "fileoff"), hexadecimal)
     yield textHandler(UInt64(self, "filesize"), hexadecimal)
     yield UInt32(self, "maxprot")
     yield UInt32(self, "initprot")
     yield UInt32(self, "nsects")
     yield UInt32(self, "flags")
     for i in range(self['nsects'].value):
         yield MachoSection64(self, "section[]")
Example #7
0
 def createFields(self):
     yield String(self, "sectname", 16, strip="\0")
     yield String(self, "segname", 16, strip="\0")
     yield textHandler(UInt64(self, "addr"), hexadecimal)
     yield textHandler(UInt64(self, "size"), hexadecimal)
     yield textHandler(UInt32(self, "offset"), hexadecimal)
     yield textHandler(UInt32(self, "align"), hexadecimal)
     yield textHandler(UInt32(self, "reloff"), hexadecimal)
     yield UInt32(self, "nreloc")
     yield UInt32(self, "flags")
     yield UInt32(self, "reserved1")
     yield UInt32(self, "reserved2")
     yield RawBytes(self, "padding", 4)
Example #8
0
 def createFields(self):
     yield UInt32(self, "unknown[]", "Version number?")
     yield UInt32(self, "count", "Number of entries")
     yield UInt32(self, "entry_size", "Size of each entry")
     yield UInt32(self, "header_size", "Size of this header")
     yield UInt64(self, "uncompressed_size")
     yield UInt64(self, "compressed_size")
     yield UInt64(self, "block_size", "Block size in bytes")
     for i in range(self["count"].value):
         yield UInt64(
             self, "block_location[]",
             "location in compressed data of 1st block boundary in uncompressed data"
         )
Example #9
0
 def parseStandardInfo(self):
     yield TimestampWin64(self, "ctime", "File Creation")
     yield TimestampWin64(self, "atime", "File Altered")
     yield TimestampWin64(self, "mtime", "MFT Changed")
     yield TimestampWin64(self, "rtime", "File Read")
     yield MSDOSFileAttr32(self, "file_attr", "DOS File Permissions")
     yield UInt32(self, "max_version", "Maximum Number of Versions")
     yield UInt32(self, "version", "Version Number")
     yield UInt32(self, "class_id")
     yield UInt32(self, "owner_id")
     yield UInt32(self, "security_id")
     yield filesizeHandler(UInt64(self, "quota_charged", "Quota Charged"))
     yield UInt64(self, "usn", "Update Sequence Number (USN)")
Example #10
0
def parseVideoHeader(parent):
    yield NullBytes(parent, "padding[]", 2)
    yield String(parent, "fourcc", 4)
    yield UInt32(parent, "size")
    yield textHandler(UInt64(parent, "time_unit", "Frame duration"), formatTimeUnit)
    yield UInt64(parent, "sample_per_unit")
    yield UInt32(parent, "default_len")
    yield UInt32(parent, "buffer_size")
    yield UInt16(parent, "bits_per_sample")
    yield NullBytes(parent, "padding[]", 2)
    yield UInt32(parent, "width")
    yield UInt32(parent, "height")
    yield NullBytes(parent, "padding[]", 4)
Example #11
0
 def createFields(self):
     yield GUID(self, "guid")
     yield filesizeHandler(UInt64(self, "file_size"))
     yield TimestampWin64(self, "creation_date")
     yield UInt64(self, "pckt_count")
     yield TimedeltaWin64(self, "play_duration")
     yield TimedeltaWin64(self, "send_duration")
     yield TimedeltaMillisWin64(self, "preroll")
     yield Bit(self, "broadcast", "Is broadcast?")
     yield Bit(self, "seekable", "Seekable stream?")
     yield PaddingBits(self, "reserved[]", 30)
     yield filesizeHandler(UInt32(self, "min_pckt_size"))
     yield filesizeHandler(UInt32(self, "max_pckt_size"))
     yield displayHandler(UInt32(self, "max_bitrate"), humanBitRate)
Example #12
0
    def createFields(self):
        yield Bytes(self, "signature", 4, "Usually the magic is 'FILE'")
        yield UInt16(self, "usa_offset", "Update Sequence Array offset")
        yield UInt16(self, "usa_count", "Update Sequence Array count")
        yield UInt64(self, "lsn", "$LogFile sequence number for this record")
        yield UInt16(self, "sequence_number",
                     "Number of times this mft record has been reused")
        yield UInt16(self, "link_count", "Number of hard links")
        yield UInt16(self, "attrs_offset",
                     "Byte offset to the first attribute")
        yield MFT_Flags(self, "flags")
        yield UInt32(self, "bytes_in_use",
                     "Number of bytes used in this record")
        yield UInt32(self, "bytes_allocated",
                     "Number of bytes allocated for this record")
        yield UInt64(self, "base_mft_record")
        yield UInt16(self, "next_attr_instance")

        # The below fields are specific to NTFS 3.1+ (Windows XP and above)
        yield NullBytes(self, "reserved", 2)
        yield UInt32(self, "mft_record_number", "Number of this mft record")

        if self["usa_offset"].value:
            padding = self.seekByte(self["usa_offset"].value, relative=True)
            if padding:
                yield padding

            yield UInt16(self, "usa_number")
            for i in range(self["usa_count"].value):
                yield UInt16(self, "usa_value[]")

        padding = self.seekByte(self["attrs_offset"].value, relative=True)
        if padding:
            yield padding

        while not self.eof:
            addr = self.absolute_address + self.current_size
            if self.stream.readBytes(addr, 4) == b"\xFF\xFF\xFF\xFF":
                yield Bytes(self, "attr_end_marker", 8)
                break
            yield Attribute(self, "attr[]")

        size = self["bytes_in_use"].value - self.current_size // 8
        if size:
            yield RawBytes(self, "end_rawdata", size)

        size = (self.size - self.current_size) // 8
        if size:
            yield RawBytes(self, "end_padding", size,
                           "Unused but allocated bytes")
Example #13
0
 def createFields(self):
     yield UInt8(self, "version")
     yield NullBits(self, "flags", 24)
     yield UInt32(self, "reference_ID")
     yield UInt32(self, "timescale")
     if self["version"].value == 0:
         yield UInt32(self, "earliest_presentation_time")
         yield UInt32(self, "first_offset")
     else:
         yield UInt64(self, "earliest_presentation_time")
         yield UInt64(self, "first_offset")
     yield NullBits(self, "reserved", 16)
     yield UInt16(self, "reference_count")
     for i in range(self["reference_count"].value):
         yield SegmentIndexBoxReference(self, "reference[]")
Example #14
0
 def parseFilename(self):
     yield UInt64(self, "ref", "File reference to the parent directory")
     yield TimestampWin64(self, "ctime", "File Creation")
     yield TimestampWin64(self, "atime", "File Altered")
     yield TimestampWin64(self, "mtime", "MFT Changed")
     yield TimestampWin64(self, "rtime", "File Read")
     yield filesizeHandler(UInt64(self, "alloc_size", "Allocated size of the file"))
     yield filesizeHandler(UInt64(self, "real_size", "Real size of the file"))
     yield UInt32(self, "file_flags")
     yield UInt32(self, "file_flags2", "Used by EAs and Reparse")
     yield UInt8(self, "filename_length", "Filename length in characters")
     yield Enum(UInt8(self, "filename_namespace"), self.FILENAME_NAMESPACE)
     size = self["filename_length"].value * 2
     if size:
         yield String(self, "filename", size, charset="UTF-16-LE")
Example #15
0
    def createFields(self):
        # Header
        yield NullBytes(self, "zero_vector", 16)
        yield GUID(self, "fs_guid")
        yield UInt64(self, "volume_len")
        yield String(self, "signature", 4)
        yield UInt32(self, "attributes")
        yield UInt16(self, "header_len")
        yield UInt16(self, "checksum")
        yield UInt16(self, "ext_header_offset")
        yield UInt8(self, "reserved")
        yield UInt8(self, "revision")
        while True:
            bm = BlockMap(self, "block_map[]")
            yield bm
            if bm['num_blocks'].value == 0 and bm['len'].value == 0:
                break
        # TODO must handle extended header

        # Content
        while not self.eof:
            padding = paddingSize(self.current_size // 8, 8)
            if padding:
                yield PaddingBytes(self, "padding[]", padding)
            yield File(self, "file[]")
Example #16
0
 def createFields(self):
     yield UInt8(self, "version", "Version (0 or 1)")
     yield NullBits(self, "flags", 24)
     if self['version'].value == 0:
         # 32-bit version
         yield TimestampMac32(self, "creation_date", "Creation time of this presentation")
         yield TimestampMac32(self, "lastmod_date", "Last modification time of this presentation")
         yield UInt32(self, "time_scale", "Number of time-units per second")
         yield UInt32(self, "duration", "Length of presentation, in time-units")
     elif self['version'].value == 1:
         # 64-bit version
         yield TimestampMac64(self, "creation_date", "Creation time of this presentation")
         yield TimestampMac64(self, "lastmod_date", "Last modification time of this presentation")
         yield UInt32(self, "time_scale", "Number of time-units per second")
         yield UInt64(self, "duration", "Length of presentation, in time-units")
     yield QTFloat32(self, "play_speed", "Preferred playback speed (1.0 = normal)")
     yield QTFloat16(self, "volume", "Preferred playback volume (1.0 = full)")
     yield NullBytes(self, "reserved[]", 10)
     yield QTFloat32(self, "geom_a", "Width scale")
     yield QTFloat32(self, "geom_b", "Width rotate")
     yield QTFloat2_30(self, "geom_u", "Width angle")
     yield QTFloat32(self, "geom_c", "Height rotate")
     yield QTFloat32(self, "geom_d", "Height scale")
     yield QTFloat2_30(self, "geom_v", "Height angle")
     yield QTFloat32(self, "geom_x", "Position X")
     yield QTFloat32(self, "geom_y", "Position Y")
     yield QTFloat2_30(self, "geom_w", "Divider scale")
     yield UInt32(self, "preview_start")
     yield UInt32(self, "preview_length")
     yield UInt32(self, "still_poster")
     yield UInt32(self, "sel_start")
     yield UInt32(self, "sel_length")
     yield UInt32(self, "current_time")
     yield UInt32(self, "next_track_ID", "Value to use as the track ID for the next track added")
Example #17
0
 def createFields(self):
     bytes = self.stream.readBytes(self.absolute_address, 4)
     if bytes == b"\0R\0\0":
         charset = "UTF-16-BE"
     else:
         charset = "UTF-16-LE"
     yield String(self, "name", 64, charset=charset, truncate="\0")
     yield UInt16(self, "namelen", "Length of the name")
     yield Enum(UInt8(self, "type", "Property type"), self.TYPE_NAME)
     yield Enum(UInt8(self, "decorator", "Decorator"), self.DECORATOR_NAME)
     yield SECT(self, "left")
     yield SECT(self, "right")
     yield SECT(self, "child",
                "Child node (valid for storage and root types)")
     yield GUID(self, "clsid",
                "CLSID of this storage (valid for storage and root types)")
     yield NullBytes(self, "flags", 4, "User flags")
     yield TimestampWin64(
         self, "creation",
         "Creation timestamp(valid for storage and root types)")
     yield TimestampWin64(
         self, "lastmod",
         "Modify timestamp (valid for storage and root types)")
     yield SECT(
         self, "start",
         "Starting SECT of the stream (valid for stream and root types)")
     if self["/header/bb_shift"].value == 9:
         yield filesizeHandler(
             UInt32(self, "size",
                    "Size in bytes (valid for stream and root types)"))
         yield NullBytes(self, "padding", 4)
     else:
         yield filesizeHandler(
             UInt64(self, "size",
                    "Size in bytes (valid for stream and root types)"))
Example #18
0
 def createFields(self):
     yield UInt32(self, "size")
     yield RawBytes(self, "tag", 4)
     size = self["size"].value
     if size == 1:
         # 64-bit size
         yield UInt64(self, "size64")
         size = self["size64"].value - 16
     elif size == 0:
         # Unbounded atom
         if self._size is None:
             size = (self.parent.size - self.parent.current_size) // 8 - 8
         else:
             size = (self.size - self.current_size) // 8
     else:
         size = size - 8
     if self['tag'].value == 'uuid':
         yield GUID(self, "usertag")
         tag = self["usertag"].value
         size -= 16
     else:
         tag = self["tag"].value
     if size > 0:
         if tag in self.tag_info:
             handler, name, desc = self.tag_info[tag]
             yield handler(self, name, desc, size=size * 8)
         else:
             yield RawBytes(self, "data", size)
Example #19
0
 def createFields(self):
     yield UInt64(self, "zip64_end_size",
                  "Size of zip64 end of central directory record")
     yield ZipVersion(self, "version_made_by", "Version made by")
     yield ZipVersion(self, "version_needed", "Version needed to extract")
     yield UInt32(self, "number_disk", "Number of this disk")
     yield UInt32(self, "number_disk2",
                  "Number of the disk with the start of the central directory")
     yield UInt64(self, "number_entries",
                  "Total number of entries in the central directory on this disk")
     yield UInt64(self, "number_entries2",
                  "Total number of entries in the central directory")
     yield UInt64(self, "size", "Size of the central directory")
     yield UInt64(self, "offset", "Offset of start of central directory")
     if 0 < self["zip64_end_size"].value:
         yield RawBytes(self, "data_sector", self["zip64_end_size"].value,
                        "zip64 extensible data sector")
Example #20
0
 def createFields(self):
     yield UInt8(self, "version")
     yield NullBits(self, "flags", 24)
     yield UInt32(self,
                  "count",
                  description="Total entries in offset table")
     for i in range(self['count'].value):
         yield UInt64(self, "chunk_offset[]")
Example #21
0
 def createFields(self):
     yield UInt8(self, "version")
     yield NullBits(self, "flags", 24)
     yield UInt32(self, "unknown")
     yield UInt8(self, "count", description="Number of chapters")
     for i in xrange(self['count'].value):
         yield UInt64(self, "chapter_start[]")
         yield PascalString8(self, "chapter_name[]", charset='UTF-8')
Example #22
0
    def createFields(self):
        yield String(self, "file_magic", 20)
        yield UInt32(self, "header_size")
        yield UInt32(self, "file_version")
        yield UInt64(self, "file_size")
        yield UInt64(self, "creation_date")
        yield Int32(self, "min_lat")
        yield Int32(self, "min_lon")
        yield Int32(self, "max_lat")
        yield Int32(self, "max_lon")
        yield UInt16(self, "tile_size")
        yield VbeString(self, "projection")

        # flags
        yield Bit(self, "have_debug")
        yield Bit(self, "have_map_start")
        yield Bit(self, "have_start_zoom")
        yield Bit(self, "have_language_preference")
        yield Bit(self, "have_comment")
        yield Bit(self, "have_created_by")
        yield Bits(self, "reserved[]", 2)

        if self["have_map_start"].value:
            yield UInt32(self, "start_lat")
            yield UInt32(self, "start_lon")
        if self["have_start_zoom"].value:
            yield UInt8(self, "start_zoom")
        if self["have_language_preference"].value:
            yield VbeString(self, "language_preference")
        if self["have_comment"].value:
            yield VbeString(self, "comment")
        if self["have_created_by"].value:
            yield VbeString(self, "created_by")

        yield TagStringList(self, "poi_tags")
        yield TagStringList(self, "way_tags")

        yield UInt8(self, "num_zoom_intervals")
        for i in range(self["num_zoom_intervals"].value):
            yield ZoomIntervalCfg(self, "zoom_interval_cfg[]")

        for i in range(self["num_zoom_intervals"].value):
            zoomIntervalCfg = self["zoom_interval_cfg[%d]" % i]
            self.seekByte(zoomIntervalCfg[
                          "subfile_start"].value, relative=False)
            yield ZoomSubFile(self, "subfile[]", size=zoomIntervalCfg["subfile_size"].value * 8, zoomIntervalCfg=zoomIntervalCfg)
Example #23
0
 def createFields(self):
     yield UInt32(
         self, "disk_number",
         "Number of the disk with the start of the zip64 end of central directory"
     )
     yield UInt64(
         self, "relative_offset",
         "Relative offset of the zip64 end of central directory record")
     yield UInt32(self, "disk_total_number", "Total number of disks")
Example #24
0
 def createFields(self):
     yield String(self, "magic", 4, "ITSF", charset="ASCII")
     yield UInt32(self, "version")
     yield UInt32(self, "header_size", "Total header length (in bytes)")
     yield UInt32(self, "one")
     yield UInt32(self, "last_modified",
                  "Lower 32 bits of the time expressed in units of 0.1 us")
     yield Enum(UInt32(self, "lang_id", "Windows Language ID"), LANGUAGE_ID)
     yield GUID(self, "dir_uuid",
                "{7C01FD10-7BAA-11D0-9E0C-00A0-C922-E6EC}")
     yield GUID(self, "stream_uuid",
                "{7C01FD11-7BAA-11D0-9E0C-00A0-C922-E6EC}")
     yield UInt64(self, "filesize_offset")
     yield filesizeHandler(UInt64(self, "filesize_len"))
     yield UInt64(self, "dir_offset")
     yield filesizeHandler(UInt64(self, "dir_len"))
     if 3 <= self["version"].value:
         yield UInt64(self, "data_offset")
Example #25
0
    def createFields(self):
        yield UInt8(self, "version", "Version (0 or 1)")
        yield NullBits(self, "flags", 20)
        yield Bit(self, "is_in_poster")
        yield Bit(self, "is_in_preview",
                  "Is this track used when previewing the presentation?")
        yield Bit(self, "is_in_movie",
                  "Is this track used in the presentation?")
        yield Bit(self, "is_enabled", "Is this track enabled?")

        if self['version'].value == 0:
            # 32-bit version
            yield TimestampMac32(self, "creation_date",
                                 "Creation time of this track")
            yield TimestampMac32(self, "lastmod_date",
                                 "Last modification time of this track")
            yield UInt32(
                self, "track_id",
                "Unique nonzero identifier of this track within the presentation"
            )
            yield NullBytes(self, "reserved[]", 4)
            yield UInt32(self, "duration",
                         "Length of track, in movie time-units")
        elif self['version'].value == 1:
            # 64-bit version
            yield TimestampMac64(self, "creation_date",
                                 "Creation time of this track")
            yield TimestampMac64(self, "lastmod_date",
                                 "Last modification time of this track")
            yield UInt32(
                self, "track_id",
                "Unique nonzero identifier of this track within the presentation"
            )
            yield NullBytes(self, "reserved[]", 4)
            yield UInt64(self, "duration",
                         "Length of track, in movie time-units")
        yield NullBytes(self, "reserved[]", 8)
        yield Int16(
            self, "video_layer",
            "Middle layer is 0; lower numbers are closer to the viewer")
        yield Int16(self, "alternate_group",
                    "Group ID that this track belongs to (0=no group)")
        yield QTFloat16(self, "volume",
                        "Track relative audio volume (1.0 = full)")
        yield NullBytes(self, "reserved[]", 2)
        yield QTFloat32(self, "geom_a", "Width scale")
        yield QTFloat32(self, "geom_b", "Width rotate")
        yield QTFloat2_30(self, "geom_u", "Width angle")
        yield QTFloat32(self, "geom_c", "Height rotate")
        yield QTFloat32(self, "geom_d", "Height scale")
        yield QTFloat2_30(self, "geom_v", "Height angle")
        yield QTFloat32(self, "geom_x", "Position X")
        yield QTFloat32(self, "geom_y", "Position Y")
        yield QTFloat2_30(self, "geom_w", "Divider scale")
        yield QTFloat32(self, "frame_size_width")
        yield QTFloat32(self, "frame_size_height")
Example #26
0
    def createFields(self):
        yield UInt8(self, "version", "Version")
        yield NullBits(self, "flags", 24)
        yield UInt32(self, "track_id")
        yield NullBits(self, "reserved", 26)
        yield Bits(self, "length_size_of_traf_num", 2)
        yield Bits(self, "length_size_of_trun_num", 2)
        yield Bits(self, "length_size_of_sample_num", 2)
        yield UInt32(self, "number_of_entry")
        for i in xrange(self['number_of_entry'].value):
            if self['version'].value == 1:
                yield UInt64(self, "time[%i]" % i)
                yield UInt64(self, "moof_offset[%i]" % i)
            else:
                yield UInt32(self, "time[%i]" % i)
                yield UInt32(self, "moof_offset[%i]" % i)

            if self['length_size_of_traf_num'].value == 3:
                yield UInt64(self, "traf_number[%i]" % i)
            elif self['length_size_of_traf_num'].value == 2:
                yield UInt32(self, "traf_number[%i]" % i)
            elif self['length_size_of_traf_num'].value == 1:
                yield UInt16(self, "traf_number[%i]" % i)
            else:
                yield UInt8(self, "traf_number[%i]" % i)

            if self['length_size_of_trun_num'].value == 3:
                yield UInt64(self, "trun_number[%i]" % i)
            elif self['length_size_of_trun_num'].value == 2:
                yield UInt32(self, "trun_number[%i]" % i)
            elif self['length_size_of_trun_num'].value == 1:
                yield UInt16(self, "trun_number[%i]" % i)
            else:
                yield UInt8(self, "trun_number[%i]" % i)

            if self['length_size_of_sample_num'].value == 3:
                yield UInt64(self, "sample_number[%i]" % i)
            elif self['length_size_of_sample_num'].value == 2:
                yield UInt32(self, "sample_number[%i]" % i)
            elif self['length_size_of_sample_num'].value == 1:
                yield UInt16(self, "sample_number[%i]" % i)
            else:
                yield UInt8(self, "sample_number[%i]" % i)
Example #27
0
    def createFields(self):
        yield GUID(self, "guid")
        yield filesizeHandler(UInt64(self, "size"))

        size = self["size"].value - self.current_size // 8
        if 0 < size:
            if self.handler:
                yield self.handler(self, "content", size=size * 8)
            else:
                yield RawBytes(self, "content", size)
Example #28
0
 def createFields(self):
     yield textHandler(UInt64(self, "id"), hexadecimal)
     if self["id"].value == 0xe7ffdeffe7ffdeff:  # indicates that secure area is decrypted
         yield Bytes(self, "fixed[]", 6)  # always \xff\xde\xff\xe7\xff\xde
         yield Crc16(
             self, "header_crc16",
             self.stream.readBytes(self.absolute_address + (16 * 8),
                                   2048 - 16))
         yield RawBytes(self, "unknown[]", 2048 - 16 - 2)
         yield Bytes(self, "fixed[]", 2)  # always \0\0
     else:
         yield RawBytes(self, "encrypted[]", 2048 - 8)
Example #29
0
 def createFields(self):
     yield Enum(UInt32(self, "type", "Segment type"), ProgramHeader32.TYPE_NAME)
     yield ProgramFlags(self, "flags")
     yield UInt64(self, "offset", "Offset")
     yield textHandler(UInt64(self, "vaddr", "V. address"), hexadecimal)
     yield textHandler(UInt64(self, "paddr", "P. address"), hexadecimal)
     yield UInt64(self, "file_size", "File size")
     yield UInt64(self, "mem_size", "Memory size")
     yield UInt64(self, "align", "Alignment padding")
Example #30
0
    def createFields(self):
        yield UInt8(self, "version", "Version")
        yield UInt24(self, "flags")
        flags = self["flags"].value

        yield UInt32(self, "track_ID")
        if flags & 0x1:
            yield UInt64(self, "base_data_offset")
        if flags & 0x2:
            yield UInt32(self, "sample_description_index")
        if flags & 0x8:
            yield UInt32(self, "default_sample_duration")
        if flags & 0x10:
            yield UInt32(self, "default_sample_size")
        if flags & 0x20:
            yield UInt32(self, "default_sample_flags")