Skip to content
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
19 changes: 0 additions & 19 deletions CHANGELOG.md

This file was deleted.

4 changes: 1 addition & 3 deletions src/binwalk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -815,9 +815,7 @@ fn init_extraction_directory(
debug!("Created base output directory: '{extraction_directory}'");
}
Err(e) => {
error!(
"Failed to create base output directory '{extraction_directory}': {e}"
);
error!("Failed to create base output directory '{extraction_directory}': {e}");
return Err(e);
}
}
Expand Down
36 changes: 9 additions & 27 deletions src/extractors/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -276,9 +276,7 @@ impl Chroot {
}
}
} else {
error!(
"Failed to create file {safe_file_path}: path already exists"
);
error!("Failed to create file {safe_file_path}: path already exists");
}

false
Expand Down Expand Up @@ -518,9 +516,7 @@ impl Chroot {
.open(safe_file_path.clone())
{
Err(e) => {
error!(
"Failed to open file '{safe_file_path}' for appending: {e}"
);
error!("Failed to open file '{safe_file_path}' for appending: {e}");
}
Ok(mut fp) => match fp.write(data) {
Err(e) => {
Expand Down Expand Up @@ -610,9 +606,7 @@ impl Chroot {
}
}
Err(e) => {
error!(
"Failed to check if directory {safe_dir_path} exists: {e:?}"
);
error!("Failed to check if directory {safe_dir_path} exists: {e:?}");
return false;
}
}
Expand Down Expand Up @@ -655,9 +649,7 @@ impl Chroot {

match fs::metadata(safe_file_path.clone()) {
Err(e) => {
error!(
"Failed to get permissions for file {safe_file_path}: {e}"
);
error!("Failed to get permissions for file {safe_file_path}: {e}");
}
Ok(_metadata) => {
#[cfg(unix)]
Expand All @@ -668,9 +660,7 @@ impl Chroot {

match fs::set_permissions(&safe_file_path, permissions) {
Err(e) => {
error!(
"Failed to set permissions for file {safe_file_path}: {e}"
);
error!("Failed to set permissions for file {safe_file_path}: {e}");
}
Ok(_) => {
return true;
Expand Down Expand Up @@ -796,9 +786,7 @@ impl Chroot {
match unix::fs::symlink(safe_target_path, safe_symlink_path) {
Ok(_) => true,
Err(e) => {
error!(
"Failed to create symlink from {symlink} -> {target}: {e}"
);
error!("Failed to create symlink from {symlink} -> {target}: {e}");
false
}
}
Expand Down Expand Up @@ -1087,9 +1075,7 @@ fn spawn(
} else {
// Copy file data to carved file path
if !chroot.carve_file(&carved_file, file_data, signature.offset, signature.size) {
return Err(std::io::Error::other(
"Failed to carve data to disk",
));
return Err(std::io::Error::other("Failed to carve data to disk"));
}
}

Expand Down Expand Up @@ -1196,16 +1182,12 @@ fn create_output_directory(file_path: &str, offset: usize) -> Result<String, std

// First, remove the output directory if it exists from a previous run
if !chroot.remove_directory(&output_directory) {
return Err(std::io::Error::other(
"Directory deletion failed",
));
return Err(std::io::Error::other("Directory deletion failed"));
}

// Create the output directory, equivalent of mkdir -p
if !chroot.create_directory(&output_directory) {
return Err(std::io::Error::other(
"Directory creation failed",
));
return Err(std::io::Error::other("Directory creation failed"));
}

Ok(output_directory)
Expand Down
8 changes: 2 additions & 6 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,7 @@ fn main() -> ExitCode {
}

// Initialize thread pool
debug!(
"Initializing thread pool with {available_workers} workers"
);
debug!("Initializing thread pool with {available_workers} workers");
let workers = ThreadPool::new(available_workers);
let (worker_tx, worker_rx) = mpsc::channel();

Expand Down Expand Up @@ -302,9 +300,7 @@ fn spawn_worker(
// If data carving was requested as part of extraction, carve analysis results to disk
if do_carve {
let carve_count = carve_file_map(&file_data, &results);
info!(
"Carved {carve_count} data blocks to disk from {target_file}"
);
info!("Carved {carve_count} data blocks to disk from {target_file}");
}

// Report file results back to main thread
Expand Down
2 changes: 1 addition & 1 deletion src/signatures/hashes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ pub fn sha256_magic() -> Vec<Vec<u8>> {
/// MD5 constants
pub fn md5_magic() -> Vec<Vec<u8>> {
vec![
// Big endian
// Big endian
b"\xd7\x6a\xa4\x78\xe8\xc7\xb7\x56\x24\x20\x70\xdb\xc1\xbd\xce\xee".to_vec(),
// Little endian
b"\x78\xa4\x6a\xd7\x56\xb7\xc7\xe8\xdb\x70\x20\x24\xee\xce\xbd\xc1".to_vec(),
Expand Down
Loading