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

pedump help message doesn't match flag #1324

Open
superponible opened this issue Oct 29, 2024 · 1 comment
Open

pedump help message doesn't match flag #1324

superponible opened this issue Oct 29, 2024 · 1 comment
Assignees

Comments

@superponible
Copy link
Contributor

Describe the bug
The error messages in pedump don't match the expected arguments because of the hyphen vs underscore in kernel-module. @ikelos not sure if the error message should just be updated or the "kernel_module" argument should be changed to "kernel-module" at https://github.com/volatilityfoundation/volatility3/blob/develop/volatility3/framework/plugins/windows/pedump.py#L47, but that could affect any code that's expecting the underscore

To Reproduce
Steps to reproduce the behavior:

Help shows "kernel-module"

$ python3 vol.py -c lsass.json windows.pedump -h
Volatility 3 Framework 2.11.0
usage: volatility windows.pedump.PEDump [-h] [--pid [PID [PID ...]]] --base BASE [--kernel-module]

optional arguments:
  -h, --help            show this help message and exit
  --pid [PID [PID ...]]
                        Process IDs to include (all other processes are excluded)
  --base BASE           Base address to reconstruct a PE file
  --kernel-module       Extract from kernel address space.

The output message when the command is incorrect shows "kernel_module":

$ python3 vol.py -c lsass.json windows.pedump --base 0xe685141b2080
Volatility 3 Framework 2.11.0
Progress:  100.00		PDB scanning finished
PID	Process	File output
ERROR    volatility3.plugins.windows.pedump: --kernel_module or --pid must be set

But if a user tried to run that way it would fail

volatility: error: unrecognized arguments: --kernel_module

As the actual argument is "kernel-module" even though the code is "kernel_module".

$ python3 vol.py -c lsass.json windows.pedump --kernel-module --base 0xc82550b80000
Volatility 3 Framework 2.11.0
Progress:  100.00		PDB scanning finished
PID	Process	File output

4	Kernel	PE.0x0.4.0xc82550b80000.dmp
@ikelos
Copy link
Member

ikelos commented Oct 29, 2024

That's just the error messages that the plugin spits out.

vollog.error("Only --kernel_module or --pid should be set. Not both")

All argparse arguments are converted from _ to - because you can't have variables with - in the middle (because of the confusion with minus) done here in the current codebase. The error messages probably should be updated not to assume command line parameters (because there ARE other UIs for the volatility library, even though everyone forgets about them). So ideally, the error messages would say Only config options kernel_module or pid should be set, not both and then it's up to the user to translate that into something for their UI. If we wanted, we could have a ConfigOptionException that gets caught by the UI and the options in it translated for the UI, but it'd be opening up a (somewhat small) can of worms to try and do all that.

So the issue at the heart of this is "config options and UI options don't necessarily match up perfectly, so requirements on config options will throw errors that might not map perfectly to the UI". Happy for suggestions of how best to fix it, but those suggestions need to be UI independent. The CLI is not special, and shouldn't get special treatment.

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

No branches or pull requests

2 participants