Skip to content

Commit a9cdb06

Browse files
committed
feat(reports) report carved directories - CarveDirectoryReport
Carve directories were hard to explain, as they look like extraction directories and there was no public information to tell them apart. Adding this report makes the purpose of the directory visible.
1 parent 395efd0 commit a9cdb06

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

tests/test_report.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from unblob.models import ProcessResult, Task, TaskResult
1111
from unblob.processing import ExtractionConfig, process_file
1212
from unblob.report import (
13+
CarveDirectoryReport,
1314
ChunkReport,
1415
FileMagicReport,
1516
HashReport,
@@ -120,6 +121,7 @@ def hello_kitty_task_results(
120121
sha1="febca6ed75dc02e0def065e7b08f1cca87b57c74",
121122
sha256="144d8b2c949cb4943128aa0081153bcba4f38eb0ba26119cc06ca1563c4999e1",
122123
),
124+
CarveDirectoryReport(carve_dir=extract_root / "hello_kitty_extract"),
123125
UnknownChunkReport(
124126
id=ANY,
125127
start_offset=0,

unblob/processing.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
from .pool import make_pool
3535
from .report import (
3636
CalculateMultiFileExceptionReport,
37+
CarveDirectoryReport,
3738
ExtractDirectoryExistsReport,
3839
FileMagicReport,
3940
HashReport,
@@ -577,6 +578,9 @@ def _process_chunks(
577578
def _carve_then_extract_chunks(self, file, outer_chunks, unknown_chunks):
578579
carve_dir = self.config.get_carve_dir_for(self.task.path)
579580

581+
# report the technical carve directory explicitly
582+
self.result.add_report(CarveDirectoryReport(carve_dir=carve_dir))
583+
580584
for chunk in unknown_chunks:
581585
carved_unknown_path = carve_unknown_chunk(carve_dir, file, chunk)
582586
randomness = self._calculate_randomness(carved_unknown_path)

unblob/report.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,11 @@ class UnknownChunkReport(Report):
233233
randomness: Optional[RandomnessReport]
234234

235235

236+
@attr.define(kw_only=True, frozen=True)
237+
class CarveDirectoryReport(Report):
238+
carve_dir: Path
239+
240+
236241
@final
237242
@attr.define(kw_only=True, frozen=True)
238243
class MultiFileReport(Report):

0 commit comments

Comments
 (0)