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

Updated ISO extractor to support more ISO sub-types #803

Merged
merged 1 commit into from
Dec 22, 2024
Merged
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 src/extractors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ pub mod gif;
pub mod gpg;
pub mod gzip;
pub mod inflate;
pub mod iso9660;
pub mod jboot;
pub mod jffs2;
pub mod jpeg;
Expand Down
32 changes: 32 additions & 0 deletions src/extractors/iso9660.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
use crate::extractors;
use crate::extractors::sevenzip::sevenzip_extractor;

/// Describes how to run the 7z utility to extract ISO images
///
/// ```
/// use std::io::ErrorKind;
/// use std::process::Command;
/// use binwalk::extractors::common::ExtractorType;
/// use binwalk::extractors::iso9660::iso9660_extractor;
///
/// match iso9660_extractor().utility {
/// ExtractorType::None => panic!("Invalid extractor type of None"),
/// ExtractorType::Internal(func) => println!("Internal extractor OK: {:?}", func),
/// ExtractorType::External(cmd) => {
/// if let Err(e) = Command::new(&cmd).output() {
/// if e.kind() == ErrorKind::NotFound {
/// panic!("External extractor '{}' not found", cmd);
/// } else {
/// panic!("Failed to execute external extractor '{}': {}", cmd, e);
/// }
/// }
/// }
/// }
/// ```
pub fn iso9660_extractor() -> extractors::common::Extractor {
// Same as the normal 7z extractor, but give the carved file an ISO file extension.
// The file extension matters, and 7z doesn't handle some ISO sub-formats correctly if the file extension is not '.iso'.
let mut extractor = sevenzip_extractor();
extractor.extension = "iso".to_string();
extractor
}
2 changes: 1 addition & 1 deletion src/magic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ pub fn patterns() -> Vec<signatures::common::Signature> {
magic: signatures::iso9660::iso_magic(),
parser: signatures::iso9660::iso_parser,
description: signatures::iso9660::DESCRIPTION.to_string(),
extractor: Some(extractors::tsk::tsk_extractor()),
extractor: Some(extractors::iso9660::iso9660_extractor()),
},
// linux kernel
signatures::common::Signature {
Expand Down
Loading