def _preprocess(self, _): self.device_path, partition_paths = google_cloud.PreprocessAttachDisk( self.disk_name) self.mount_path = mount_local.PreprocessMountDisk( partition_paths, self.mount_partition) self.local_path = self.device_path
def _preprocess(self, _, required_states): if EvidenceState.ATTACHED in required_states: self.device_path, partition_paths = mount_local.PreprocessLosetup( self.source_path) self.state[EvidenceState.ATTACHED] = True if EvidenceState.MOUNTED in required_states: self.mount_path = mount_local.PreprocessMountDisk( partition_paths, self.mount_partition) self.local_path = self.device_path self.state[EvidenceState.MOUNTED] = True
def _preprocess(self, _, required_states): if EvidenceState.ATTACHED in required_states: self.device_path, partition_paths = google_cloud.PreprocessAttachDisk( self.disk_name) self.state[EvidenceState.ATTACHED] = True if EvidenceState.MOUNTED in required_states: self.mount_path = mount_local.PreprocessMountDisk( partition_paths, self.mount_partition) self.local_path = self.device_path self.state[EvidenceState.MOUNTED] = True
def _preprocess(self, _): rawdisk_path = os.path.join(self.parent_evidence.mount_path, self.embedded_path) if not os.path.exists(rawdisk_path): raise TurbiniaException( 'Unable to find raw disk image {0:s} in GoogleCloudDisk'. format(rawdisk_path)) self.device_path, partition_paths = mount_local.PreprocessLosetup( rawdisk_path) self.mount_path = mount_local.PreprocessMountDisk( partition_paths, self.mount_partition) self.local_path = self.device_path
def _preprocess(self, _, required_states): if EvidenceState.PARENT_ATTACHED in required_states: rawdisk_path = os.path.join(self.parent_evidence.mount_path, self.embedded_path) if not os.path.exists(rawdisk_path): raise TurbiniaException( 'Unable to find raw disk image {0:s} in GoogleCloudDisk'. format(rawdisk_path)) self.device_path, partition_paths = mount_local.PreprocessLosetup( rawdisk_path) self.state[EvidenceState.PARENT_ATTACHED] = True if EvidenceState.PARENT_MOUNTED in required_states: self.mount_path = mount_local.PreprocessMountDisk( partition_paths, self.mount_partition) self.local_path = self.device_path self.state[EvidenceState.PARENT_MOUNTED] = True
def _preprocess(self, _, required_states): # Need to mount parent disk if not self.parent_evidence.partition_paths: self.parent_evidence.mount_path = mount_local.PreprocessMountPartition( self.parent_evidence.device_path) else: partition_paths = self.parent_evidence.partition_paths self.parent_evidence.mount_path = mount_local.PreprocessMountDisk( partition_paths, self.parent_evidence.mount_partition) self.parent_evidence.local_path = self.parent_evidence.mount_path self.parent_evidence.state[EvidenceState.MOUNTED] = True if EvidenceState.ATTACHED in required_states or self.has_child_evidence: rawdisk_path = os.path.join( self.parent_evidence.mount_path, self.embedded_path) if not os.path.exists(rawdisk_path): raise TurbiniaException( 'Unable to find raw disk image {0:s} in GoogleCloudDisk'.format( rawdisk_path)) self.device_path = mount_local.PreprocessLosetup(rawdisk_path) self.state[EvidenceState.ATTACHED] = True self.local_path = self.device_path
def testPreprocessMountDisk(self, _, mock_path_exists, mock_path_isdir, mock_subprocess, mock_filesystem, mock_mkdtemp, mock_config): """Test PreprocessMountDisk method.""" mock_config.MOUNT_DIR_PREFIX = '/mnt/turbinia' mock_path_exists.side_effect = _mock_bitlocker_returns mock_filesystem.return_value = b'ext4' mock_mkdtemp.return_value = '/mnt/turbinia/turbinia0ckdntz0' # Test partition number too high with self.assertRaises(TurbiniaException): mount_local.PreprocessMountDisk(['/dev/loop0p1'], 2) # Test bad partition number with self.assertRaises(TurbiniaException): mount_local.PreprocessMountDisk(['/dev/loop0p1'], 0) # Test partition path doesn't exist with self.assertRaises(TurbiniaException): mount_local.PreprocessMountDisk(['/dev/loop0p4'], 1) # Test mount prefix is not directory mock_path_isdir.return_value = False with self.assertRaises(TurbiniaException): mount_local.PreprocessMountDisk(['/dev/loop0p1'], 1) mock_path_isdir.return_value = True # Test ext4 mount_path = mount_local.PreprocessMountDisk(['/dev/loop0p1'], 1) expected_args = [ 'sudo', 'mount', '-o', 'ro', '-o', 'noload', '/dev/loop0p1', '/mnt/turbinia/turbinia0ckdntz0' ] mock_subprocess.assert_called_once_with(expected_args) self.assertEqual(mount_path, '/mnt/turbinia/turbinia0ckdntz0') # Test mount failure mock_subprocess.reset_mock() mock_subprocess.side_effect = CalledProcessError(1, 'mount') with self.assertRaises(TurbiniaException): mount_local.PreprocessMountDisk(['/dev/loop0p1'], 1)
def _preprocess(self): self.local_path = google_cloud.PreprocessAttachDisk(self.disk_name) self.loopdevice_path = mount_local.PreprocessLosetup(self.local_path) self.mount_path = mount_local.PreprocessMountDisk( self.loopdevice_path, self.mount_partition) self.local_path = os.path.join(self.mount_path, self.embedded_path)
def preprocess(self): google_cloud.PreprocessAttachDisk(self) mount_local.PreprocessMountDisk(self) self.local_path = os.path.join(self.mount_path, self.embedded_path)
def _preprocess(self, _): self.device_path, partition_paths = mount_local.PreprocessLosetup( self.source_path) self.mount_path = mount_local.PreprocessMountDisk( partition_paths, self.mount_partition) self.local_path = self.device_path