-
Notifications
You must be signed in to change notification settings - Fork 590
Windows: update psscan to fix issue #591 #1788
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
Draft
eve-mem
wants to merge
5
commits into
volatilityfoundation:develop
Choose a base branch
from
eve-mem:windows_psscan_issue_591_2
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
d6918f8
Windows: update psscan to fix issue #591
eve-mem a3e903e
Add test for windows.psscan --physical option
eve-mem 2ea6e2f
Add test for windows.psscan --physical option
eve-mem 7063268
Ensure that pluginargs is a tuple for test_windows_specific_psscan_ph…
eve-mem 0674909
Windows: update patch version of psscan
eve-mem File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,7 +23,7 @@ class PsScan(interfaces.plugins.PluginInterface, timeliner.TimeLinerInterface): | |
| """Scans for processes present in a particular windows memory image.""" | ||
|
|
||
| _required_framework_version = (2, 3, 1) | ||
| _version = (2, 0, 0) | ||
| _version = (2, 0, 1) | ||
|
|
||
| @classmethod | ||
| def get_requirements(cls): | ||
|
|
@@ -269,39 +269,60 @@ def _generator(self): | |
| filter_func=pslist.PsList.create_pid_filter(self.config.get("pid", None)), | ||
| ): | ||
| file_output = "Disabled" | ||
| if self.config["dump"]: | ||
| # windows 10 objects (maybe others in the future) are already in virtual memory | ||
| if proc.vol.layer_name == kernel.layer_name: | ||
| vproc = proc | ||
|
|
||
| # windows 10 objects (maybe others in the future) are already in virtual memory | ||
| # if the proc native_layer_name and layer_name match then it is in 'virtual' memory. | ||
| if proc.vol.layer_name == proc.vol.native_layer_name: | ||
| # proc is already in a virtual mem, so a new object is not needed. it means | ||
| # that if physical addresses are requested in the output then proc.vol.offset | ||
| # cannot be used because it will be virtual, so the mapping is needed. | ||
| vproc = proc | ||
| if self.config["physical"]: | ||
| # the display should be physical addresses, so proc cannot be used. The | ||
| # mappings are needed to find where it would be physically. | ||
| _, _, offset, _, _ = list( | ||
| memory.mapping(offset=proc.vol.offset, length=0) | ||
| )[0] | ||
| else: | ||
| try: | ||
| vproc = self.virtual_process_from_physical( | ||
| self.context, | ||
| self.config["kernel"], | ||
| proc, | ||
| ) | ||
| except exceptions.PagedInvalidAddressException: | ||
| vproc = None | ||
| # the display should be virtual addresses, so proc can be used | ||
| offset = proc.vol.offset | ||
|
|
||
| # renderers.UnreadableValue() | ||
| else: | ||
| # proc is in virtual mem, so a new object needs to be creatd. | ||
| vproc = self.virtual_process_from_physical( | ||
| self.context, self.config["kernel"], proc | ||
| ) | ||
| if self.config["physical"]: | ||
| # the display should be physical addresses, so proc can be used | ||
| # as it is | ||
| offset = proc.vol.offset | ||
| else: | ||
| # the display should be virtual address, so vproc should be used | ||
| # however virtual_process_from_physical is not always able to create | ||
| # a vproc, in that case we need to display a UnreadableValue() | ||
| if vproc is not None: | ||
| offset = vproc.vol.offset | ||
| else: | ||
| offset = None | ||
|
|
||
| if self.config["dump"]: | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ideally we'd guard for |
||
| file_handle = pslist.PsList.process_dump( | ||
| self.context, | ||
| kernel.symbol_table_name, | ||
| pe_table_name, | ||
| vproc, | ||
| self.open, | ||
| ) | ||
| file_output = "Error outputting file" | ||
| if vproc: | ||
| file_handle = pslist.PsList.process_dump( | ||
| self.context, | ||
| kernel.symbol_table_name, | ||
| pe_table_name, | ||
| vproc, | ||
| self.open, | ||
| ) | ||
|
|
||
| if file_handle: | ||
| file_output = file_handle.preferred_filename | ||
|
|
||
| if not self.config["physical"]: | ||
| offset = proc.vol.offset | ||
| if file_handle: | ||
| file_output = file_handle.preferred_filename | ||
|
|
||
| # format offset for display | ||
| if offset is None: | ||
| display_offset = renderers.UnreadableValue() | ||
| else: | ||
| (_, _, offset, _, _) = list( | ||
| memory.mapping(offset=proc.vol.offset, length=0) | ||
| )[0] | ||
| display_offset = format_hints.Hex(offset) | ||
|
|
||
| try: | ||
| yield ( | ||
|
|
@@ -314,7 +335,7 @@ def _generator(self): | |
| max_length=proc.ImageFileName.vol.count, | ||
| errors="replace", | ||
| ), | ||
| format_hints.Hex(offset), | ||
| display_offset, | ||
| proc.ActiveThreads, | ||
| proc.get_handle_count(), | ||
| proc.get_session_id(), | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't a robust test (it only works when
scan_processesreturns carved processes), and I don't really want people using it to determine whether an address is physical or not. The poolscanner's been asked to scan the kernel layer, so... it should only ever return virtual results? Have you verified that the "else" branch ever gets hit?