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

Windows: Add regex filtering to dumpfiles #1083

Conversation

brandon-barnacle
Copy link
Contributor

In volatility2, the windows.dumpfiles plugin allows you to filter the dumped files using a regular expression. This PR adds the same functionality to volatility3.

The regular expression is passed in using --regex=REGEX and all files matching REGEX will be dumped. The --ignore-case flag can be passed to make the search case-insensitive. The search is case-sensitive by default. The matching volatility2 functionality can be found here:
https://github.com/volatilityfoundation/volatility/blob/a438e768194a9e05eb4d9ee9338b881c0fa25937/volatility/plugins/dumpfiles.py#L844

Manual testing was performed on windows memory images across different windows versions to verify the expected output.

In volatility2, the windows.dumpfiles plugin allows you to filter the dumped files
using a regular expression. This PR adds the same functionality to volatility3.

The regular expression is passed in using --regex=REGEX and all files matching
REGEX will be dumped. The --ignore-case flag can be passed to make the search
case-insensitive. The search is case-sensitive by default. The matching
volatility2 functionality can be found here:
https://github.com/volatilityfoundation/volatility/blob/a438e768194a9e05eb4d9ee
9338b881c0fa25937/volatility/plugins/dumpfiles.py#L844

Manual testing was performed on windows memory images across different windows
versions to verify the expected output.
Copy link
Member

@ikelos ikelos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally the coding style looks good, and the changes are minimal, but adding options to a plugin always needs some thinking about, so there's just some questions about the precedence of the command line options and how that would work.

volatility3/framework/plugins/windows/dumpfiles.py Outdated Show resolved Hide resolved
volatility3/framework/plugins/windows/dumpfiles.py Outdated Show resolved Hide resolved
volatility3/framework/plugins/windows/dumpfiles.py Outdated Show resolved Hide resolved
Change the --regex flag to --filter. Add a check so that --filter
cannot be used with --physaddr or --virtaddr. Change
self.config["filter"] check to check if file_re has been set.
@brandon-barnacle brandon-barnacle force-pushed the bbarnacle/windows-dumpfiles branch from 6b181e2 to ae5375a Compare January 26, 2024 16:24
Copy link
Member

@ikelos ikelos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this looks much better. Please could you make sure it's formatted by black and then we can get it merged... 5:)

@ikelos
Copy link
Member

ikelos commented Jan 28, 2024

So the rest of the codebase was still formatted against 23.12.0 rather than 24.1.0 (which is what github now uses). The issues it's finding are from the original code, so this should merge in just fine and I'll fix it up manually if not...

@ikelos ikelos merged commit b211dc1 into volatilityfoundation:develop Jan 28, 2024
13 of 14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants