Unverified Commit 01ea4f53 by devttys0 Committed by GitHub

Merge pull request #310 from nezza/master

Add support for extracing into subdirectories named by the offset.
parents 2ed5e099 bb3d1e74
......@@ -100,6 +100,10 @@ class Extractor(Module):
long='carve',
kwargs={'run_extractors': False},
description="Carve data from files, but don't execute extraction utilities"),
Option(short='T',
long='subdirs',
kwargs={'extract_into_subdirs': True},
description="Extract into sub-directories named by the offset"),
]
KWARGS = [
......@@ -110,6 +114,7 @@ class Extractor(Module):
Kwarg(name='remove_after_execute', default=False),
Kwarg(name='load_default_rules', default=False),
Kwarg(name='run_extractors', default=True),
Kwarg(name='extract_into_subdirs', default=False),
Kwarg(name='manual_rules', default=[]),
Kwarg(name='matryoshka', default=0),
Kwarg(name='enabled', default=False),
......@@ -580,6 +585,12 @@ class Extractor(Module):
if os.path.isfile(file_path):
os.chdir(output_directory)
# Extract into subdirectories named by the offset
if self.extract_into_subdirs:
# Remove trailing L that is added by hex()
offset_dir = "0x%X" % offset
os.mkdir(offset_dir)
os.chdir(offset_dir)
# Loop through each extraction rule until one succeeds
for i in range(0, len(rules)):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment