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

Add flag --nofile to prevent a file from being written in the ConfigWriter plugin #1356

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
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: 13 additions & 6 deletions volatility3/framework/plugins/configwriter.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ def get_requirements(cls) -> List[interfaces.configuration.RequirementInterface]
default=False,
optional=True,
),
requirements.BooleanRequirement(
name="nofile",
description="Do not write file to output directory, only print to stdout",
default=False,
optional=True,
),
]

def _generator(self):
Expand All @@ -45,13 +51,14 @@ def _generator(self):
config = dict(self.context.config)
filename = "config.extra"
try:
with self.open(filename) as file_data:
file_data.write(
bytes(
json.dumps(config, sort_keys=True, indent=2),
"raw_unicode_escape",
if not self.config.get("nofile"):
with self.open(filename) as file_data:
file_data.write(
bytes(
json.dumps(config, sort_keys=True, indent=2),
"raw_unicode_escape",
)
)
)
except Exception as excp:
vollog.warning(f"Unable to JSON encode configuration: {excp}")

Expand Down