Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed EWF support #1438

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docker/tests/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ RUN apt-get update && apt-get -y install \
bulk-extractor \
docker-explorer-tools \
sleuthkit \
libewf-tools \
&& apt-get clean && rm -rf /var/cache/apt/* /var/lib/apt/lists/*

# Add turbinia user to system and sudoers
Expand Down
1 change: 1 addition & 0 deletions docker/worker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ RUN apt-get update && apt-get -y install \
libfsapfs-tools \
libluksde-tools \
sleuthkit \
libewf-tools \
&& apt-get clean && rm -rf /var/cache/apt/* /var/lib/apt/lists/*

# Add turbinia user to system and sudoers
Expand Down
Binary file added test_data/ext2.E01
Binary file not shown.
44 changes: 44 additions & 0 deletions turbinia/processors/mount_local_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,50 @@ def testPreprocessLosetup(self, mock_subprocess, mock_config):
with self.assertRaises(TurbiniaException):
mount_local.PreprocessLosetup(source_path)

@mock.patch('turbinia.processors.mount_local.config')
@mock.patch('tempfile.mkdtemp')
@mock.patch('subprocess.check_call')
@mock.patch('os.path.isdir')
@mock.patch('os.path.exists')
@mock.patch('os.makedirs')
def testPreprocessMountEwfDisk(
self, _, mock_path_exists, mock_path_isdir, mock_subprocess, mock_mkdtemp,
mock_config):
"""Test PreprocessMountEwfDisk method."""
mock_config.MOUNT_DIR_PREFIX = '/mnt/turbinia'
mock_path_exists.side_effect = _mock_bitlocker_returns
mock_mkdtemp.return_value = '/mnt/turbinia/turbinia0ckdntz0'

current_path = os.path.abspath(os.path.dirname(__file__))
source_path = os.path.join(
current_path, '..', '..', 'test_data', 'ext2.E01')

# Test ewfmount
mock_path_isdir.return_value = True
device = mount_local.PreprocessMountEwfDisk(source_path)
expected_args = [
'sudo', 'ewfmount', '-X', 'allow_other', source_path,
'/mnt/turbinia/turbinia0ckdntz0'
]
mock_subprocess.assert_called_once_with(expected_args)
self.assertEqual(device, '/mnt/turbinia/turbinia0ckdntz0')

# Test if source does not exist
with self.assertRaises(TurbiniaException):
mount_local.PreprocessMountEwfDisk('/dev/loop0p4')

# Test if mount path not directory
mock_path_isdir.return_value = False
with self.assertRaises(TurbiniaException):
mount_local.PreprocessMountEwfDisk(source_path)
mock_path_isdir.return_value = True

# Test ewfmount failure
mock_subprocess.reset_mock()
mock_subprocess.side_effect = CalledProcessError(1, 'ewfmount')
with self.assertRaises(TurbiniaException):
device = mount_local.PreprocessMountEwfDisk(source_path)

@mock.patch('subprocess.check_output')
@mock.patch('subprocess.check_call')
def testPreprocessLVM(self, mock_subprocess, mock_output):
Expand Down