

def GetPartitionIdentifiers(self, volume_system, volume_identifiers):
    'Retrieves partition identifiers.\n\n    This method can be used to prompt the user to provide partition identifiers.\n\n    Args:\n      volume_system: the volume system (instance of dfvfs.TSKVolumeSystem).\n      volume_identifiers: a list of strings containing the volume identifiers.\n\n    Returns:\n      A list of strings containing the selected partition identifiers or None.\n\n    Raises:\n      ScannerError: if the source cannot be processed.\n    '
    print('The following partitions were found:')
    print('Identifier\tOffset (in bytes)\tSize (in bytes)')
    for volume_identifier in sorted(volume_identifiers):
        volume = volume_system.GetVolumeByIdentifier(volume_identifier)
        if (not volume):
            raise errors.ScannerError('Volume missing for identifier: {0:s}.'.format(volume_identifier))
        volume_extent = volume.extents[0]
        print('{0:s}\t\t{1:d} (0x{1:08x})\t{2:s}'.format(volume.identifier, volume_extent.offset, self._FormatHumanReadableSize(volume_extent.size)))
    while True:
        print('Please specify the identifier of the partition that should be processed.')
        print('All partitions can be defined as: "all". Note that you can abort with Ctrl^C.')
        selected_volume_identifier = sys.stdin.readline()
        selected_volume_identifier = selected_volume_identifier.strip()
        if (not selected_volume_identifier.startswith('p')):
            try:
                partition_number = int(selected_volume_identifier, 10)
                selected_volume_identifier = 'p{0:d}'.format(partition_number)
            except ValueError:
                pass
        if (selected_volume_identifier == 'all'):
            return volume_identifiers
        if (selected_volume_identifier in volume_identifiers):
            break
        print('')
        print('Unsupported partition identifier, please try again or abort with Ctrl^C.')
        print('')
    return [selected_volume_identifier]

dataset/ETHPy150Open log2timeline/dfvfs/examples/recursive_hasher.py RecursiveHasherVolumeScannerMediator.GetPartitionIdentifiers/original