-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
generic_carver: replaced external call to unblob with use of internal…
… methods
- Loading branch information
Showing
13 changed files
with
106 additions
and
224 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file removed
BIN
-50 Bytes
fact_extractor/plugins/unpacking/generic_carver/test/data/fake_7z.7z
Binary file not shown.
Binary file removed
BIN
-400 Bytes
fact_extractor/plugins/unpacking/generic_carver/test/data/fake_gz.gz
Binary file not shown.
Binary file removed
BIN
-500 Bytes
fact_extractor/plugins/unpacking/generic_carver/test/data/fake_tar.tar
Binary file not shown.
Binary file removed
BIN
-130 Bytes
fact_extractor/plugins/unpacking/generic_carver/test/data/fake_xz.bin
Binary file not shown.
Binary file removed
BIN
-30 Bytes
fact_extractor/plugins/unpacking/generic_carver/test/data/fake_xz.xz
Binary file not shown.
Binary file removed
BIN
-100 Bytes
fact_extractor/plugins/unpacking/generic_carver/test/data/fake_zip.zip
Binary file not shown.
Binary file removed
BIN
-152 Bytes
fact_extractor/plugins/unpacking/generic_carver/test/data/trailing_data.bz2
Binary file not shown.
Binary file removed
BIN
-270 Bytes
fact_extractor/plugins/unpacking/generic_carver/test/data/trailing_data.zip
Binary file not shown.
35 changes: 35 additions & 0 deletions
35
fact_extractor/plugins/unpacking/generic_carver/test/test_plugin_generic_carver.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
from pathlib import Path | ||
|
||
from helperFunctions.file_system import get_test_data_dir | ||
from test.unit.unpacker.test_unpacker import TestUnpackerBase | ||
|
||
# pylint: disable=protected-access | ||
|
||
TEST_DATA_DIR = Path(__file__).parent / 'data' | ||
|
||
|
||
class TestGenericCarver(TestUnpackerBase): | ||
def test_unpacker_selection_generic(self): | ||
self.check_unpacker_selection('generic/carver', 'generic_carver') | ||
|
||
def test_extraction(self): | ||
in_file = f'{get_test_data_dir()}/generic_carver_test' | ||
files, meta_data = self.unpacker._extract_files_from_file_using_specific_unpacker( | ||
in_file, self.tmp_dir.name, self.unpacker.unpacker_plugins['generic/carver'] | ||
) | ||
files = set(files) | ||
assert len(files) == 3, 'file number incorrect' | ||
assert f'{self.tmp_dir.name}/100-887.zip' in files, 'hidden zip not identified correctly' | ||
assert 'output' in meta_data | ||
|
||
def test_filter(self): | ||
in_file = TEST_DATA_DIR / 'carving_test_file' | ||
assert Path(in_file).is_file() | ||
files, meta_data = self.unpacker._extract_files_from_file_using_specific_unpacker( | ||
str(in_file), self.tmp_dir.name, self.unpacker.unpacker_plugins['generic/carver'] | ||
) | ||
files = set(files) | ||
assert len(files) == 4, 'file number incorrect' | ||
assert 'removed chunk 300-428' in meta_data['output'] | ||
for file in ('0-128.unknown', '128-300.zip', '428-562.sevenzip', '562-626.unknown'): | ||
assert f'{self.tmp_dir.name}/{file}' in files |
71 changes: 0 additions & 71 deletions
71
fact_extractor/plugins/unpacking/generic_carver/test/test_plugin_generic_carver_binwalk.py
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters