How to use the pycdlib.udf.UDFEntityID function in pycdlib

To help you get started, we’ve selected a few pycdlib examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github clalancette / pycdlib / tests / unit / test_udf.py View on Github external
def test_entityid_parse_bad_flags():
    entity = pycdlib.udf.UDFEntityID()
    with pytest.raises(pycdlib.pycdlibexception.PyCdlibInvalidISO) as excinfo:
        entity.parse(b'\x04' + b'\x00'*31)
    assert(str(excinfo.value) == 'UDF Entity ID flags must be between 0 and 3')
github clalancette / pycdlib / tests / unit / test_udf.py View on Github external
def test_entityid_new_bad_identifier():
    entity = pycdlib.udf.UDFEntityID()
    with pytest.raises(pycdlib.pycdlibexception.PyCdlibInvalidInput) as excinfo:
        entity.new(0, b'\x00'*25)
    assert(str(excinfo.value) == 'UDF Entity ID identifier must be less than 23 characters')
github clalancette / pycdlib / tests / unit / test_udf.py View on Github external
def test_entityid_equals():
    entity = pycdlib.udf.UDFEntityID()
    entity.new(0)

    entity2 = pycdlib.udf.UDFEntityID()
    entity2.new(0)

    assert(entity == entity2)
github clalancette / pycdlib / tests / unit / test_udf.py View on Github external
def test_entityid_equals():
    entity = pycdlib.udf.UDFEntityID()
    entity.new(0)

    entity2 = pycdlib.udf.UDFEntityID()
    entity2.new(0)

    assert(entity == entity2)
github clalancette / pycdlib / pycdlib / udf.py View on Github external
extent - The extent that this descriptor currently lives at.
         desc_tag - A UDFTag object that represents the Descriptor Tag.
        Returns:
         Nothing.
        '''
        if self._initialized:
            raise pycdlibexception.PyCdlibInternalError('UDF Partition Volume Descriptor already initialized')

        (tag_unused, self.vol_desc_seqnum, self.part_flags, self.part_num,
         part_contents, part_contents_use, self.access_type,
         self.part_start_location, self.part_length, impl_ident,
         self.implementation_use, reserved_unused) = struct.unpack_from(self.FMT, data, 0)

        self.desc_tag = desc_tag

        self.part_contents = UDFEntityID()
        self.part_contents.parse(part_contents)
        if self.part_contents.identifier[:6] != b'+NSR02':
            raise pycdlibexception.PyCdlibInvalidISO("Partition Contents Identifier not '+NSR02'")

        self.impl_ident = UDFEntityID()
        self.impl_ident.parse(impl_ident)

        self.part_contents_use = UDFPartitionHeaderDescriptor()
        self.part_contents_use.parse(part_contents_use)

        self.orig_extent_loc = extent

        self._initialized = True
github clalancette / pycdlib / pycdlib / udf.py View on Github external
if interchange_level != 2:
            raise pycdlibexception.PyCdlibInvalidISO('Only DVD Read-Only disks are supported')
        if char_set_list != 1:
            raise pycdlibexception.PyCdlibInvalidISO('Only DVD Read-Only disks are supported')
        if max_char_set_list != 1:
            raise pycdlibexception.PyCdlibInvalidISO('Only DVD Read-Only disks are supported')
        if flags != 0:
            raise pycdlibexception.PyCdlibInvalidISO('Only DVD Read-Only disks are supported')

        if reserved != b'\x00' * 22:
            raise pycdlibexception.PyCdlibInvalidISO('UDF Primary Volume Descriptor reserved data not 0')

        self.recording_date = UDFTimestamp()
        self.recording_date.parse(recording_date)

        self.app_ident = UDFEntityID()
        self.app_ident.parse(app_ident)

        self.impl_ident = UDFEntityID()
        self.impl_ident.parse(impl_ident)

        self.orig_extent_loc = extent

        self._initialized = True
github clalancette / pycdlib / pycdlib / udf.py View on Github external
Parameters:
         None.
        Returns:
         Nothing.
        '''
        if self._initialized:
            raise pycdlibexception.PyCdlibInternalError('UDF File Set Descriptor already initialized')

        self.desc_tag = UDFTag()
        self.desc_tag.new(256)  # FIXME: we should let the user set serial_number

        self.recording_date = UDFTimestamp()
        self.recording_date.new()

        self.domain_ident = UDFEntityID()
        self.domain_ident.new(0, b'*OSTA UDF Compliant', b'\x02\x01\x03')

        self.root_dir_icb = UDFLongAD()
        self.root_dir_icb.new(2048, 2)

        self.file_set_num = 0
        self.log_vol_char_set = _unicodecharset()
        self.log_vol_ident = _ostaunicode_zero_pad('CDROM', 128)
        self.file_set_char_set = _unicodecharset()
        self.file_set_ident = _ostaunicode_zero_pad('CDROM', 32)
        self.copyright_file_ident = b'\x00' * 32  # FIXME: let the user set this
        self.abstract_file_ident = b'\x00' * 32  # FIXME: let the user set this

        self._initialized = True
github clalancette / pycdlib / pycdlib / udf.py View on Github external
A method to create a new UDF Implementation Use Volume Descriptor.

        Parameters:
         None:
        Returns:
         Nothing.
        '''
        if self._initialized:
            raise pycdlibexception.PyCdlibInternalError('UDF Implementation Use Volume Descriptor already initialized')

        self.desc_tag = UDFTag()
        self.desc_tag.new(4)  # FIXME: we should let the user set serial_number

        self.vol_desc_seqnum = 1

        self.impl_ident = UDFEntityID()
        self.impl_ident.new(0, b'*UDF LV Info', b'\x02\x01')

        self.impl_use = UDFImplementationUseVolumeDescriptorImplementationUse()
        self.impl_use.new()

        self._initialized = True
github clalancette / pycdlib / pycdlib / udf.py View on Github external
Parameters:
         None.
        Returns:
         Nothing.
        '''
        if self._initialized:
            raise pycdlibexception.PyCdlibInternalError('UDF Partition Volume Descriptor already initialized')

        self.desc_tag = UDFTag()
        self.desc_tag.new(5)  # FIXME: we should let the user set serial_number

        self.vol_desc_seqnum = 2
        self.part_flags = 1  # FIXME: how should we set this?
        self.part_num = 0  # FIXME: how should we set this?

        self.part_contents = UDFEntityID()
        self.part_contents.new(2, b'+NSR02')

        self.part_contents_use = UDFPartitionHeaderDescriptor()
        self.part_contents_use.new()

        self.access_type = 1
        self.part_start_location = 0  # This will get set later
        self.part_length = 3  # This will get set later

        self.impl_ident = UDFEntityID()
        self.impl_ident.new(0, b'*pycdlib')

        self.implementation_use = b'\x00' * 128  # FIXME: we should let the user set this

        self._initialized = True
github clalancette / pycdlib / pycdlib / udf.py View on Github external
'''
        Parse the passed in data into a UDF Logical Volume Implementation Use.

        Parameters:
         data - The data to parse.
        Returns:
         Nothing.
        '''
        if self._initialized:
            raise pycdlibexception.PyCdlibInternalError('UDF Logical Volume Implementation Use already initialized')

        (impl_id, self.num_files, self.num_dirs, self.min_udf_read_revision,
         self.min_udf_write_revision,
         self.max_udf_write_revision) = struct.unpack_from(self.FMT, data, 0)

        self.impl_id = UDFEntityID()
        self.impl_id.parse(impl_id)

        self.impl_use = data[46:]

        self._initialized = True