@@ -134,8 +134,9 @@ def process_file(
134134
135135 process_result = _process_task (config , task )
136136
137- # ensure that the root extraction directory is created even for empty extractions
138- extract_dir .mkdir (parents = True , exist_ok = True )
137+ if not config .skip_extraction :
138+ # ensure that the root extraction directory is created even for empty extractions
139+ extract_dir .mkdir (parents = True , exist_ok = True )
139140
140141 if report_file :
141142 write_json_report (report_file , process_result )
@@ -468,7 +469,7 @@ def __init__(
468469 def process (self ):
469470 logger .debug ("Processing file" , path = self .task .path , size = self .size )
470471
471- if self .carve_dir .exists ():
472+ if not self . config . skip_extraction and self .carve_dir .exists ():
472473 # Extraction directory is not supposed to exist, it is usually a simple mistake of running
473474 # unblob again without cleaning up or using --force.
474475 # It would cause problems continuing, as it would mix up original and extracted files,
@@ -508,6 +509,13 @@ def _process_chunks(
508509 if unknown_chunks :
509510 logger .warning ("Found unknown Chunks" , chunks = unknown_chunks )
510511
512+ if self .config .skip_extraction :
513+ for chunk in unknown_chunks :
514+ self .result .add_report (chunk .as_report (entropy = None ))
515+ for chunk in outer_chunks :
516+ self .result .add_report (chunk .as_report (extraction_reports = []))
517+ return
518+
511519 for chunk in unknown_chunks :
512520 carved_unknown_path = carve_unknown_chunk (self .carve_dir , file , chunk )
513521 entropy = self ._calculate_entropy (carved_unknown_path )
0 commit comments