Skip to content

Commit

Permalink
Removed deb unpacker (fkie-cad#117)
Browse files Browse the repository at this point in the history
Patool can already extract debian archives.
  • Loading branch information
jstucke authored Apr 7, 2023
1 parent f17a4d7 commit 7a1441e
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 45 deletions.
Empty file.
Empty file.
18 changes: 0 additions & 18 deletions fact_extractor/plugins/unpacking/deb/code/deb.py

This file was deleted.

Empty file.
17 changes: 0 additions & 17 deletions fact_extractor/plugins/unpacking/deb/test/test_deb.py

This file was deleted.

48 changes: 38 additions & 10 deletions fact_extractor/plugins/unpacking/patool/code/patool.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,42 @@

NAME = 'PaTool'
MIME_PATTERNS = [
'application/x-lrzip', 'application/x-cpio', 'application/x-archive', 'application/x-adf',
'application/x-redhat-package-manager', 'application/x-rpm', 'application/x-lzop', 'application/x-lzh',
'application/x-lha', 'application/x-cab', 'application/vnd.ms-cab-compressed', 'application/zpaq',
'application/x-chm', 'application/x-gzip', 'application/gzip', 'application/x-bzip2', 'application/x-dms',
'application/x-debian-package', 'application/x-rzip', 'application/x-tar', 'application/x-shar',
'application/x-lzip', 'application/x-alzip', 'application/x-rar', 'application/rar',
'application/java-archive', 'application/x-iso9660-image', 'application/x-compress', 'application/x-arc',
'audio/flac', 'application/x-ace', 'application/x-zoo', 'application/x-xz'
'application/gzip',
'application/java-archive',
'application/rar',
'application/vnd.debian.binary-package',
'application/vnd.ms-cab-compressed',
'application/x-ace',
'application/x-adf',
'application/x-alzip',
'application/x-arc',
'application/x-archive',
'application/x-bzip2',
'application/x-cab',
'application/x-chm',
'application/x-compress',
'application/x-cpio',
'application/x-debian-package',
'application/x-dms',
'application/x-gzip',
'application/x-iso9660-image',
'application/x-lha',
'application/x-lrzip',
'application/x-lzh',
'application/x-lzip',
'application/x-lzop',
'application/x-rar',
'application/x-redhat-package-manager',
'application/x-rpm',
'application/x-rzip',
'application/x-shar',
'application/x-tar',
'application/x-xz',
'application/x-zoo',
'application/zpaq',
'audio/flac',
]
VERSION = '0.5.2'
VERSION = '0.5.3'

TOOL_PATH = execute_shell_command('which patool').strip()

Expand All @@ -25,7 +51,9 @@ def unpack_function(file_path, tmp_dir):
tmp_dir should be used to store the extracted files.
"""
return {
'output': execute_shell_command('fakeroot python3 {} extract --outdir {} {}'.format(TOOL_PATH, tmp_dir, file_path), timeout=600)
'output': execute_shell_command(
f'fakeroot python3 {TOOL_PATH} extract --outdir {tmp_dir} {file_path}', timeout=600
)
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,9 @@ def test_extraction(self, in_file, ignore):
output=False,
ignore=ignore,
)

def test_extract_deb(self):
in_file = os.path.join(TEST_DATA_DIR, 'test.deb')
files, meta_data = self.unpacker.extract_files_from_file(in_file, self.tmp_dir.name)
assert len(files) == 3, f'file number incorrect: {meta_data}'
assert 'extracted to' in meta_data['output']

0 comments on commit 7a1441e

Please sign in to comment.