From 933fc47258e702e8b9806885f9af12f6fd62bd53 Mon Sep 17 00:00:00 2001 From: devttys0 Date: Wed, 30 Oct 2024 10:00:19 -0400 Subject: [PATCH] Replaced unzip with 7z extractor --- dependencies/ubuntu.sh | 1 - src/extractors.rs | 1 - src/extractors/zip.rs | 18 ------------------ src/magic.rs | 2 +- 4 files changed, 1 insertion(+), 21 deletions(-) delete mode 100644 src/extractors/zip.rs diff --git a/dependencies/ubuntu.sh b/dependencies/ubuntu.sh index 26c301e12..594096832 100755 --- a/dependencies/ubuntu.sh +++ b/dependencies/ubuntu.sh @@ -7,7 +7,6 @@ SCRIPT_DIRECTORY=$(dirname -- "$( readlink -f -- "$0"; )") DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get -y install \ p7zip-full \ zstd \ - unzip \ tar \ sleuthkit \ cabextract \ diff --git a/src/extractors.rs b/src/extractors.rs index 51e948c77..87b19ff52 100644 --- a/src/extractors.rs +++ b/src/extractors.rs @@ -180,6 +180,5 @@ pub mod uimage; pub mod vxworks; pub mod wince; pub mod yaffs2; -pub mod zip; pub mod zlib; pub mod zstd; diff --git a/src/extractors/zip.rs b/src/extractors/zip.rs deleted file mode 100644 index 5ba90ccfc..000000000 --- a/src/extractors/zip.rs +++ /dev/null @@ -1,18 +0,0 @@ -use crate::extractors; - -/// Describes how to run the unzip utility to extract ZIP archives -pub fn zip_extractor() -> extractors::common::Extractor { - extractors::common::Extractor { - utility: extractors::common::ExtractorType::External("unzip".to_string()), - extension: "zip".to_string(), - arguments: vec![ - "-o".to_string(), // Overwrite files without prompting - "-P".to_string(), // Specify a password for encrypted ZIP files - "''".to_string(), // Just use a blank password - extractors::common::SOURCE_FILE_PLACEHOLDER.to_string(), - ], - // Exit code 2 occurs when a CRC fails; files are still extracted though - exit_codes: vec![0, 2], - ..Default::default() - } -} diff --git a/src/magic.rs b/src/magic.rs index 46883390b..a3336104c 100644 --- a/src/magic.rs +++ b/src/magic.rs @@ -212,7 +212,7 @@ pub fn patterns() -> Vec { magic: signatures::zip::zip_magic(), parser: signatures::zip::zip_parser, description: signatures::zip::DESCRIPTION.to_string(), - extractor: Some(extractors::zip::zip_extractor()), + extractor: Some(extractors::sevenzip::sevenzip_extractor()), }, // Intel PCH ROM signatures::common::Signature {