original_docstring: Scans the source path for volume and file systems.
  
      This functions sets the internal source path specification and source
      type values.
  
      Args:
        options: the command line arguments (instance of argparse.Namespace).
  
      Raises:
        SourceScannerError: if the format of or within the source
                            is not supported or the the scan context
                            is invalid.
      
docstring: Scans the source path for volume and file systems.
  This functions sets the internal source path specification and source
  type values.
docstring_tokens: Scans the source path for volume and file systems . This functions sets the internal source path specification and source type values .
code: def ScanSource(self, options):
      """Scans the source path for volume and file systems.
  
      This functions sets the internal source path specification and source
      type values.
  
      Args:
        options: the command line arguments (instance of argparse.Namespace).
  
      Raises:
        SourceScannerError: if the format of or within the source
                            is not supported or the the scan context
                            is invalid.
      """
      partition_number = getattr(options, 'partition_number', None)
      if (partition_number is not None and
          isinstance(partition_number, basestring)):
        try:
          partition_number = int(partition_number, 10)
        except ValueError:
          logging.warning(u'Invalid partition number: {0:s}.'.format(
              partition_number))
          partition_number = None
  
      partition_offset = getattr(options, 'image_offset_bytes', None)
      if (partition_offset is not None and
          isinstance(partition_offset, basestring)):
        try:
          partition_offset = int(partition_offset, 10)
        except ValueError:
          logging.warning(u'Invalid image offset bytes: {0:s}.'.format(
              partition_offset))
          partition_offset = None
  
      if partition_offset is None and hasattr(options, 'image_offset'):
        image_offset = getattr(options, 'image_offset')
        bytes_per_sector = getattr(options, 'bytes_per_sector', 512)
  
        if isinstance(image_offset, basestring):
          try:
            image_offset = int(image_offset, 10)
          except ValueError:
            logging.warning(u'Invalid image offset: {0:s}.'.format(image_offset))
            image_offset = None
  
        if isinstance(bytes_per_sector, basestring):
          try:
            bytes_per_sector = int(bytes_per_sector, 10)
          except ValueError:
            logging.warning(u'Invalid bytes per sector: {0:s}.'.format(
                bytes_per_sector))
            bytes_per_sector = 512
  
        if image_offset:
          partition_offset = image_offset * bytes_per_sector
  
      self._process_vss = not getattr(options, 'no_vss', False)
      if self._process_vss:
        vss_stores = getattr(options, 'vss_stores', None)
        if vss_stores:
          vss_stores = self._ParseVssStores(vss_stores)
  
      # Use the dfVFS source scanner to do the actual scanning.
      scan_path_spec = None
  
      self._scan_context.OpenSourcePath(self._source_path)
  
      while True:
        self._scan_context = self._source_scanner.Scan(
            self._scan_context, scan_path_spec=scan_path_spec)
  
        # The source is a directory or file.
        if self._scan_context.source_type in [
            self._scan_context.SOURCE_TYPE_DIRECTORY,
            self._scan_context.SOURCE_TYPE_FILE]:
          break
  
        if not self._scan_context.last_scan_node:
          raise errors.SourceScannerError(
              u'No supported file system found in source: {0:s}.'.format(
                  self._source_path))
  
        # The source scanner found a file system.
        if self._scan_context.last_scan_node.type_indicator in [
            dfvfs_definitions.TYPE_INDICATOR_TSK]:
          break
  
        # The source scanner found a BitLocker encrypted volume and we need
        # a credential to unlock the volume.
        if self._scan_context.last_scan_node.type_indicator in [
            dfvfs_definitions.TYPE_INDICATOR_BDE]:
          # TODO: ask for password.
          raise errors.SourceScannerError(
              u'BitLocker encrypted volume not yet supported.')
  
        # The source scanner found a partition table and we need to determine
        # which partition needs to be processed.
        elif self._scan_context.last_scan_node.type_indicator in [
            dfvfs_definitions.TYPE_INDICATOR_TSK_PARTITION]:
          scan_node = self._GetVolumeTSKPartition(
              self._scan_context, partition_number=partition_number,
              partition_offset=partition_offset)
          if not scan_node:
            break
          self._scan_context.last_scan_node = scan_node
  
          self._partition_offset = getattr(scan_node.path_spec, 'start_offset', 0)
  
        elif self._scan_context.last_scan_node.type_indicator in [
            dfvfs_definitions.TYPE_INDICATOR_VSHADOW]:
          if self._process_vss:
            self._GetVolumeVssStoreIdentifiers(
                self._scan_context, vss_stores=vss_stores)
  
          # Get the scan node of the current volume.
          scan_node = self._scan_context.last_scan_node.GetSubNodeByLocation(u'/')
          self._scan_context.last_scan_node = scan_node
          break
  
        else:
          raise errors.SourceScannerError(
              u'Unsupported volume system found in source: {0:s}.'.format(
                  self._source_path))
  
      self._source_type = self._scan_context.source_type
  
      if self._scan_context.source_type in [
          self._scan_context.SOURCE_TYPE_STORAGE_MEDIA_DEVICE,
          self._scan_context.SOURCE_TYPE_STORAGE_MEDIA_IMAGE]:
  
        if self._scan_context.last_scan_node.type_indicator not in [
            dfvfs_definitions.TYPE_INDICATOR_TSK]:
          logging.warning(
              u'Unsupported file system falling back to single file mode.')
          self._source_type = self._scan_context.source_type
  
        elif self._partition_offset is None:
          self._partition_offset = 0
code_tokens: def ScanSource ( self , options ) : partition_number = getattr ( options , 'partition_number' , None ) if ( partition_number is not None and isinstance ( partition_number , basestring ) ) : try : partition_number = int ( partition_number , 10 ) except ValueError : logging . warning ( u'Invalid partition number: {0:s}.' . format ( partition_number ) ) partition_number = None partition_offset = getattr ( options , 'image_offset_bytes' , None ) if ( partition_offset is not None and isinstance ( partition_offset , basestring ) ) : try : partition_offset = int ( partition_offset , 10 ) except ValueError : logging . warning ( u'Invalid image offset bytes: {0:s}.' . format ( partition_offset ) ) partition_offset = None if partition_offset is None and hasattr ( options , 'image_offset' ) : image_offset = getattr ( options , 'image_offset' ) bytes_per_sector = getattr ( options , 'bytes_per_sector' , 512 ) if isinstance ( image_offset , basestring ) : try : image_offset = int ( image_offset , 10 ) except ValueError : logging . warning ( u'Invalid image offset: {0:s}.' . format ( image_offset ) ) image_offset = None if isinstance ( bytes_per_sector , basestring ) : try : bytes_per_sector = int ( bytes_per_sector , 10 ) except ValueError : logging . warning ( u'Invalid bytes per sector: {0:s}.' . format ( bytes_per_sector ) ) bytes_per_sector = 512 if image_offset : partition_offset = image_offset * bytes_per_sector self . _process_vss = not getattr ( options , 'no_vss' , False ) if self . _process_vss : vss_stores = getattr ( options , 'vss_stores' , None ) if vss_stores : vss_stores = self . _ParseVssStores ( vss_stores ) scan_path_spec = None self . _scan_context . OpenSourcePath ( self . _source_path ) while True : self . _scan_context = self . _source_scanner . Scan ( self . _scan_context , scan_path_spec = scan_path_spec ) if self . _scan_context . source_type in [ self . _scan_context . SOURCE_TYPE_DIRECTORY , self . _scan_context . SOURCE_TYPE_FILE ] : break if not self . _scan_context . last_scan_node : raise errors . SourceScannerError ( u'No supported file system found in source: {0:s}.' . format ( self . _source_path ) ) if self . _scan_context . last_scan_node . type_indicator in [ dfvfs_definitions . TYPE_INDICATOR_TSK ] : break if self . _scan_context . last_scan_node . type_indicator in [ dfvfs_definitions . TYPE_INDICATOR_BDE ] : raise errors . SourceScannerError ( u'BitLocker encrypted volume not yet supported.' ) elif self . _scan_context . last_scan_node . type_indicator in [ dfvfs_definitions . TYPE_INDICATOR_TSK_PARTITION ] : scan_node = self . _GetVolumeTSKPartition ( self . _scan_context , partition_number = partition_number , partition_offset = partition_offset ) if not scan_node : break self . _scan_context . last_scan_node = scan_node self . _partition_offset = getattr ( scan_node . path_spec , 'start_offset' , 0 ) elif self . _scan_context . last_scan_node . type_indicator in [ dfvfs_definitions . TYPE_INDICATOR_VSHADOW ] : if self . _process_vss : self . _GetVolumeVssStoreIdentifiers ( self . _scan_context , vss_stores = vss_stores ) scan_node = self . _scan_context . last_scan_node . GetSubNodeByLocation ( u'/' ) self . _scan_context . last_scan_node = scan_node break else : raise errors . SourceScannerError ( u'Unsupported volume system found in source: {0:s}.' . format ( self . _source_path ) ) self . _source_type = self . _scan_context . source_type if self . _scan_context . source_type in [ self . _scan_context . SOURCE_TYPE_STORAGE_MEDIA_DEVICE , self . _scan_context . SOURCE_TYPE_STORAGE_MEDIA_IMAGE ] : if self . _scan_context . last_scan_node . type_indicator not in [ dfvfs_definitions . TYPE_INDICATOR_TSK ] : logging . warning ( u'Unsupported file system falling back to single file mode.' ) self . _source_type = self . _scan_context . source_type elif self . _partition_offset is None : self . _partition_offset = 0
short_docstring: Scans the source path for volume and file systems.
short_docstring_tokens: Scans the source path for volume and file systems .
comment: """Scans the source path for volume and file systems.
  
      This functions sets the internal source path specification and source
      type values.
  
      Args:
        options: the command line arguments (instance of argparse.Namespace).
  
      Raises:
        SourceScannerError: if the format of or within the source
                            is not supported or the the scan context
                            is invalid.
      """$SEP$# Use the dfVFS source scanner to do the actual scanning.$SEP$# The source is a directory or file.$SEP$# The source scanner found a file system.$SEP$# The source scanner found a BitLocker encrypted volume and we need$SEP$# a credential to unlock the volume.$SEP$# TODO: ask for password.$SEP$# The source scanner found a partition table and we need to determine$SEP$# which partition needs to be processed.$SEP$# Get the scan node of the current volume.