Ejemplo n.º 1
0
 def createFields(self):
     yield UInt8(self, "version", "Version")
     yield NullBits(self, "flags", 24)
     yield UInt32(self, "size")
Ejemplo n.º 2
0
 def createFields(self):
     yield UInt8(self, "version")
     yield NullBits(self, "flags", 24)
     yield UInt32(self, "count")
     for i in xrange(self['count'].value):
         yield Atom(self, "key[]")
Ejemplo n.º 3
0
 def createFields(self):
     yield Enum(UInt8(self, "typecode"), TYPECODE_NAMES)
     yield Int32(self, "handle")
Ejemplo n.º 4
0
 def createFields(self):
     yield UInt8(self, "version", "Version")
     yield NullBits(self, "flags", 23)
     yield Bit(self, "is_same_file", "Is the reference to this file?")
     if not self['is_same_file'].value:
         yield CString(self, "location")
Ejemplo n.º 5
0
 def createFields(self):
     yield Enum(UInt8(self, "typecode"), TYPECODE_NAMES)
     self.root.resetHandles()
     yield SerializedObject(self, "object")
     self.root.resetHandles()
Ejemplo n.º 6
0
 def createFields(self):
     yield Enum(UInt8(self, "typecode"), TYPECODE_NAMES)
     yield SerializedContent(self, "classDesc")
     self.root.newHandle(self)
     yield SerializedContent(self, "enumConstantName")
Ejemplo n.º 7
0
 def createFields(self):
     yield UInt8(self, "version")
     yield NullBits(self, "flags", 24)
     yield UInt32(self, "count", description="Number of sync samples")
     for i in range(self['count'].value):
         yield UInt32(self, "sample_number[]")
Ejemplo n.º 8
0
 def createFields(self):
     yield Enum(UInt8(self, "typecode"), TYPECODE_NAMES)
     self.root.resetHandles()
Ejemplo n.º 9
0
 def createFields(self):
     yield FlashU30(self, "value_index")
     yield UInt8(self, "value_kind")
Ejemplo n.º 10
0
 def createFields(self):
     yield UInt8(self, "version")
     yield NullBits(self, "flags", 24)
     yield UInt32(self, "count", description="Total entries in table")
     for i in range(self['count'].value):
         yield SampleEntry(self, "sample_entry[]")
Ejemplo n.º 11
0
 def createFields(self):
     yield Enum(UInt8(self, "kind"), self.NAMESPACE_KIND)
     yield ABCStringIndex(self, "name_index")
Ejemplo n.º 12
0
def parseStrictMode(parent, size):
    yield UInt8(parent, "strict")
Ejemplo n.º 13
0
def parseStoreRegister(parent, size):
    yield UInt8(parent, "register")
Ejemplo n.º 14
0
def parseWaitForFrameDyn(parent, size):
    yield UInt8(parent, "skip")
Ejemplo n.º 15
0
 def createFields(self):
     yield UInt8(self, "base_zoom_level")
     yield UInt8(self, "min_zoom_level")
     yield UInt8(self, "max_zoom_level")
     yield UInt64(self, "subfile_start")
     yield UInt64(self, "subfile_size")
Ejemplo n.º 16
0
 def createFields(self):
     yield Enum(UInt8(self, "typecode"), TYPECODE_NAMES)
     self.root.newHandle(self)
     yield PascalString16(self, "value", charset="UTF-8")
Ejemplo n.º 17
0
 def createFields(self):
     yield Enum(UInt8(self, "compression", "Compression method"),
                self.COMPRESSION_NAME)
Ejemplo n.º 18
0
 def createFields(self):
     yield Enum(UInt8(self, "typecode"), TYPECODE_NAMES)
     yield UInt32(self, "size")
     if self['size'].value:
         yield RawBytes(self, "data", self['size'].value)
Ejemplo n.º 19
0
    def createFields(self):
        os = self["/superblock/creator_os"].value

        yield FileMode(self, "mode", "File mode")
        yield UInt16(self, "uid", "User ID")
        yield UInt32(self, "size", "File size (in bytes)")
        yield TimestampUnix32(self, "atime", "Last access time")
        yield TimestampUnix32(self, "ctime", "Last inode change time")
        yield TimestampUnix32(self, "mtime", "Last data modification time")
        yield TimestampUnix32(self, "dtime", "Deletion time")
        yield UInt16(self, "gid", "Group ID")
        yield UInt16(self, "links_count", "Hard link count")
        yield UInt32(self, "blocks", "Number of blocks")
        yield InodeFlags(self, "flags", "Flags")
        if os == SuperBlock.OS_LINUX:
            yield UInt32(self, "version_high",
                         "High 32 bits of the version field")
        else:
            yield NullBytes(self, "reserved[]", 4, "Reserved")

        filetype = FileMode.file_type_letter.get(self['mode/file_type'].value,
                                                 '-')
        if filetype in 'bc':
            yield UInt8(self, "dev_minor",
                        "Minor number of the block/char device")
            yield UInt8(self, "dev_major",
                        "Major number of the block/char device")
            yield NullBytes(self, "block_unused", 58)
        elif filetype == 'l' and self['size'].value <= 60 and self[
                'blocks'].value == 0:
            yield String(self, "link_target", self['size'].value,
                         "Target filename of this symlink")
            rest = 60 - self['size'].value
            if rest:
                yield NullBytes(self, "block_unused", rest)
        elif self['flags/extents'].value:
            yield ExtentNode(self, "extent_root", size=60 * 8)
        else:
            for index in range(15):
                yield UInt32(self, "block[]")

        yield UInt32(self, "version", "File version, for NFS")
        yield UInt32(self, "file_acl", "File ACL of the xattr block")
        yield UInt32(self, "size_high", "High 32 bits of the file size")
        yield UInt32(
            self, "faddr",
            "Block where the fragment of the file resides (obsolete)")

        if os == SuperBlock.OS_LINUX:
            yield UInt16(self, "blocks_high",
                         "High 16 bits of the block count")
            yield UInt16(self, "file_acl_high",
                         "High 16 bits of the xattr block")
            yield UInt16(self, "uid_high", "High 16 bits of user ID")
            yield UInt16(self, "gid_high", "High 16 bits of group ID")
            yield UInt16(self, "checksum", "inode checksum")
            yield NullBytes(self, "reserved[]", 2, "Reserved")
        elif os == SuperBlock.OS_HURD:
            yield UInt8(self, "frag", "Number of fragments in the block")
            yield UInt8(self, "fsize", "Fragment size")
            yield UInt16(self, "mode_high", "High 16 bits of mode")
            yield UInt16(self, "uid_high", "High 16 bits of user ID")
            yield UInt16(self, "gid_high", "High 16 bits of group ID")
            yield UInt32(self, "author", "Author ID (?)")
        else:
            yield RawBytes(self, "raw", 12, "Reserved")
Ejemplo n.º 20
0
 def createFields(self):
     yield Enum(UInt8(self, "typecode"), TYPECODE_NAMES)
     self.root.newHandle(self)
     yield LongString(self, "value")
Ejemplo n.º 21
0
    def createFields(self):
        yield UInt32(self, "inodes_count", "Total inode count")
        yield UInt32(self, "blocks_count", "Total block count")
        yield UInt32(self, "r_blocks_count",
                     "Reserved (superuser-only) block count")
        yield UInt32(self, "free_blocks_count", "Free block count")
        yield UInt32(self, "free_inodes_count", "Free inode count")
        yield UInt32(self, "first_data_block", "First data block")
        yield UInt32(self, "log_block_size",
                     "Block size = 2**(10+log_block_size)")
        yield UInt32(self, "log_frag_size", "Cluster size = 2**log_frag_size")
        yield UInt32(self, "blocks_per_group", "Blocks per group")
        yield UInt32(self, "frags_per_group", "Fragments per group")
        yield UInt32(self, "inodes_per_group", "Inodes per group")
        yield TimestampUnix32(self, "mtime", "Mount time")
        yield TimestampUnix32(self, "wtime", "Write time")
        yield UInt16(self, "mnt_count", "Mount count since the last fsck")
        yield UInt16(self, "max_mnt_count",
                     "Max mount count before fsck is needed")
        yield UInt16(self, "magic", "Magic number (0xEF53)")
        yield Enum(UInt16(self, "state", "File system state"), self.state_desc)
        yield Enum(UInt16(self, "errors", "Behaviour when detecting errors"),
                   self.error_handling_desc)
        yield UInt16(self, "minor_rev_level", "Minor revision level")
        yield TimestampUnix32(self, "last_check", "Time of last check")
        yield textHandler(
            UInt32(self, "check_interval", "Maximum time between checks"),
            self.postMaxTime)
        yield Enum(UInt32(self, "creator_os", "Creator OS"), self.os_name)
        yield Enum(UInt32(self, "rev_level", "Revision level"),
                   self.revision_levels)
        yield UInt16(self, "def_resuid", "Default uid for reserved blocks")
        yield UInt16(self, "def_resgid", "Default gid for reserved blocks")
        yield UInt32(self, "first_ino", "First non-reserved inode")
        yield UInt16(self, "inode_size", "Size of inode structure")
        yield UInt16(self, "block_group_nr",
                     "Block group # of this superblock")
        yield FeatureCompatFlags(
            self, "feature_compat",
            "Compatible feature set (can mount even if these features are unsupported)"
        )
        yield FeatureIncompatFlags(
            self, "feature_incompat",
            "Incompatible feature set (must support all features to mount)")
        yield FeatureROCompatFlags(
            self, "feature_ro_compat",
            "Read-only compatible feature set (can only mount r/o if a feature is unsupported)"
        )
        yield UUID(self, "uuid", "128-bit UUID for volume")
        yield String(self, "volume_name", 16, "Volume name", strip="\0")
        yield String(self,
                     "last_mounted",
                     64,
                     "Directory where last mounted",
                     strip="\0")
        yield UInt32(self, "compression",
                     "For compression (algorithm usage bitmap)")
        yield UInt8(self, "prealloc_blocks",
                    "Number of blocks to try to preallocate")
        yield UInt8(self, "prealloc_dir_blocks",
                    "Number to preallocate for directories")
        yield UInt16(self, "reserved_gdt_blocks",
                     "Number of reserved GDT entries for future expansion")
        yield RawBytes(self, "journal_uuid", 16, "UUID of journal superblock")
        yield UInt32(self, "journal_inum", "Inode number of journal file")
        yield UInt32(
            self, "journal_dev",
            "Device number of journal file (if ext_journal feature is set)")
        yield UInt32(self, "last_orphan",
                     "Start of list of orphaned inodes to delete")
        # ext3 stuff
        yield RawBytes(self, "hash_seed", 16,
                       "Seeds used for the directory indexing hash algorithm")
        yield Enum(
            UInt8(self, "def_hash_version",
                  "Default hash version for directory indexing"),
            self.htree_hash_algo_desc)
        yield UInt8(self, "jnl_backup_type",
                    "Does jnl_blocks contain a backup of i_block and i_size?")
        yield UInt16(self, "desc_size",
                     "Size of group descriptors (if 64bit feature is set)")
        yield DefaultMountOptionFlags(self, "default_mount_opts",
                                      "Default mount options")
        yield UInt32(
            self, "first_meta_bg",
            "First metablock block group (if meta_bg feature is set)")
        yield TimestampUnix32(self, "mkfs_time",
                              "When the filesystem was created")
        yield RawBytes(self, "jnl_blocks", 17 * 4,
                       "Backup of the journal inode's i_block and i_size")

        yield PaddingBytes(self, "reserved[]",
                           (1024 << self['log_block_size'].value) -
                           self.current_size // 8)
Ejemplo n.º 22
0
 def createValue(self):
     val = UInt8.createValue(self)
     return (val != 0)
Ejemplo n.º 23
0
def recoveryHeader(s):
    yield filesizeHandler(UInt32(s, "total_size"))
    yield textHandler(UInt8(s, "version"), hexadecimal)
    yield UInt16(s, "rec_sectors")
    yield UInt32(s, "total_blocks")
    yield RawBytes(s, "mark", 8)
Ejemplo n.º 24
0
 def createFields(self):
     yield UInt8(self, "version", "Version")
     yield NullBits(self, "flags", 24)
     yield QTFloat16(self, "balance")
     yield UInt16(self, "reserved[]")
Ejemplo n.º 25
0
 def createFields(self):
     yield UInt32(self, "sample_header_size")
     yield GenericVector(self, "notes", 96, UInt8, "sample")
     yield GenericVector(self, "volume_envelope", 24, UInt16, "point")
     yield GenericVector(self, "panning_envelope", 24, UInt16, "point")
     yield UInt8(self, "volume_points", r"Number of volume points")
     yield UInt8(self, "panning_points", r"Number of panning points")
     yield UInt8(self, "volume_sustain_point")
     yield UInt8(self, "volume_loop_start_point")
     yield UInt8(self, "volume_loop_end_point")
     yield UInt8(self, "panning_sustain_point")
     yield UInt8(self, "panning_loop_start_point")
     yield UInt8(self, "panning_loop_end_point")
     yield StuffType(self, "volume_type")
     yield StuffType(self, "panning_type")
     yield UInt8(self, "vibrato_type")
     yield UInt8(self, "vibrato_sweep")
     yield UInt8(self, "vibrato_depth")
     yield UInt8(self, "vibrato_rate")
     yield UInt16(self, "volume_fadeout")
     yield GenericVector(self, "reserved", 11, UInt16, "word")
Ejemplo n.º 26
0
 def createFields(self):
     yield UInt8(self, "version", "Version")
     yield NullBits(self, "flags", 24)
     yield UInt32(self, "sequence_number")
Ejemplo n.º 27
0
    def createFields(self):
        yield String(self,
                     "header_id",
                     4,
                     "Track Item Header Markup (\"mhit\")",
                     charset="ISO-8859-1")
        yield UInt32(self, "header_length", "Header Length")
        yield UInt32(self, "entry_length", "Entry Length")
        yield UInt32(self, "string_number", "Number of Strings")
        yield UInt32(self, "unique_id", "Unique ID")
        yield UInt32(self, "visible_tag", "Visible Tag")
        yield String(self, "file_type", 4, "File Type")
        yield Enum(UInt8(self, "x1_type", "Extended Type 1"),
                   self.x1_type_name)
        yield Enum(UInt8(self, "x2_type", "Extended type 2"),
                   self.x2_type_name)
        yield UInt8(self, "compilation_flag", "Compilation Flag")
        yield UInt8(self, "rating", "Rating")
        yield TimestampMac32(self, "last_modified",
                             "Time of the last modification of the track")
        yield filesizeHandler(UInt32(self, "size", "Track size in bytes"))
        yield displayHandler(
            UInt32(self, "length", "Track length in milliseconds"),
            humanDuration)
        yield UInt32(self, "track_number", "Number of this track")
        yield UInt32(self, "total_track", "Total number of tracks")
        yield UInt32(self, "year", "Year of the track")
        yield UInt32(self, "bitrate", "Bitrate")
        yield UInt32(self, "samplerate", "Sample Rate")
        yield UInt32(self, "volume", "volume")
        yield UInt32(self, "start_time", "Start playing at, in milliseconds")
        yield UInt32(self, "stop_time", "Stop playing at,  in milliseconds")
        yield UInt32(self, "soundcheck", "SoundCheck preamp")
        yield UInt32(self, "playcount_1", "Play count of the track")
        yield UInt32(self, "playcount_2",
                     "Play count of the track when last synced")
        yield TimestampMac32(self, "last_played_time",
                             "Time the song was last played")
        yield UInt32(self, "disc_number", "disc number in multi disc sets")
        yield UInt32(self, "total_discs",
                     "Total number of discs in the disc set")
        yield UInt32(self, "userid", "User ID in the DRM scheme")
        yield TimestampMac32(self, "added_date",
                             "Date when the item was added")
        yield UInt32(self, "bookmark_time", "Bookmark time for AudioBook")
        yield UInt64(
            self, "dbid",
            "Unique DataBase ID for the song (identical in mhit and in mhii)")
        yield UInt8(self, "checked", "song is checked")
        yield UInt8(self, "application_rating", "Last Rating before change")
        yield UInt16(self, "BPM", "BPM of the track")
        yield UInt16(self, "artwork_count", "number of artworks for this item")
        yield UInt16(self, "unknown[]")
        yield UInt32(self, "artwork_size", "Total size of artworks in bytes")
        yield UInt32(self, "unknown[]")
        yield Float32(self, "sample_rate_2", "Sample Rate express in float")
        yield UInt32(self, "released_date",
                     "Date of release in Music Store or in Podcast")
        yield UInt16(self, "unknown[]")
        yield UInt16(self, "explicit_flag[]", "Explicit flag")
        yield UInt32(self, "unknown[]")
        yield UInt32(self, "unknown[]")
        yield UInt32(self, "skip_count[]", "Skip Count")
        yield TimestampMac32(self, "last_skipped",
                             "Date when the item was last skipped")
        yield UInt8(self, "has_artwork",
                    "0x01 for track with artwork, 0x02 otherwise")
        yield UInt8(self, "skip_wen_shuffling",
                    "Skip that track when shuffling")
        yield UInt8(self, "remember_playback_position",
                    "Remember playback position")
        yield UInt8(self, "flag4", "Flag 4")
        yield UInt64(self, "dbid2",
                     "Unique DataBase ID for the song (identical as above)")
        yield UInt8(self, "lyrics_flag", "Lyrics Flag")
        yield UInt8(self, "movie_file_flag", "Movie File Flag")
        yield UInt8(self, "played_mark", "Track has been played")
        yield UInt8(self, "unknown[]")
        yield UInt32(self, "unknown[]")
        yield UInt32(self, "pregap[]",
                     "Number of samples of silence before the song starts")
        yield UInt64(
            self, "sample_count",
            "Number of samples in the song (only for WAV and AAC files)")
        yield UInt32(self, "unknown[]")
        yield UInt32(self, "postgap[]",
                     "Number of samples of silence at the end of the song")
        yield UInt32(self, "unknown[]")
        yield Enum(UInt32(self, "media_type", "Media Type for video iPod"),
                   self.media_type_name)
        yield UInt32(self, "season_number", "Season Number")
        yield UInt32(self, "episode_number", "Episode Number")
        yield UInt32(self, "unknown[]")
        yield UInt32(self, "unknown[]")
        yield UInt32(self, "unknown[]")
        yield UInt32(self, "unknown[]")
        yield UInt32(self, "unknown[]")
        yield UInt32(self, "unknown[]")
        yield UInt32(self, "unknown[]")
        yield UInt32(
            self, "gapless_data[]",
            "The size in bytes from first Sync Frame until the 8th before the last frame."
        )
        yield UInt32(self, "unknown[]")
        yield UInt16(self, "gaplessTrackFlag[]", "1 if track has gapless data")
        yield UInt16(self, "gaplessAlbumFlag[]",
                     "1 if track uses crossfading in iTunes")
        yield RawBytes(self, "unknown[]", 20)
        yield UInt32(self, "unknown[]")
        yield UInt32(self, "unknown[]")
        yield UInt32(self, "unknown[]")
        yield UInt32(self, "unknown[]")
        yield UInt16(self, "unknown[]")
        yield UInt16(self, "album_id[]",
                     "Album ID (used to link tracks with MHIAs)")
        yield RawBytes(self, "unknown[]", 52)
        yield UInt32(self, "mhii_link[]",
                     "Artwork ID (used to link tracks with MHIIs)")
        padding = self.seekByte(self["header_length"].value, "header padding")
        if padding:
            yield padding

        # while ((self.stream.readBytes(0, 4) == b'mhod') and
        # ((self.current_size//8) < self["entry_length"].value)):
        for i in range(self["string_number"].value):
            yield DataObject(self, "data[]")
        padding = self.seekBit(self._size, "entry padding")
        if padding:
            yield padding
Ejemplo n.º 28
0
 def createFields(self):
     yield UInt8(self, "unk[]", "0x80 or 0x00")
     yield PascalString16(self, "tag_name", charset='UTF-8')
     yield UInt16(self, "unk[]", "0x0001")
     yield UInt16(self, "unk[]", "0x0000")
     yield PascalString16(self, "tag_value", charset='UTF-8')
Ejemplo n.º 29
0
    def createFields(self):
        yield Enum(UInt8(self, "typecode"), TYPECODE_NAMES)
        yield SerializedContent(self, "classDesc")
        self.root.newHandle(self)

        yield ObjectValue(self, "value")
Ejemplo n.º 30
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 xrange(self['count'].value):
         yield UInt32(self, "chunk_offset[]")
Ejemplo n.º 31
0
 def createValue(self):
     val = UInt8.createValue(self)
     return val != 0