This fixes all import from statements in the codebase that were
importing things other than modules into module namespaces from other
volatility3 modules. This should prevent accidental re-exporting.
This checks `ast.ImportFrom` statements to see if anything other than
modules are being imported in this way. It enumerates all instances of
this and suggests a fix.
This change sets the `script`, `script-only`, and `primary` requirements
to only apply to the `generic.Volshell` class. `regex-scanner` is okay
to be shared between the base and inherited classes, but `script` and
`script-only` have to be generic-only in order to avoid conflicts when
populating the argparse parser.
`primary` must be generic-only in order to avoid ending up unsatisfied
when superclass requirements require a module, suppressing construction
of the `primary` layer.
Instead of using the tree-sitter third party library, this uses Python's
`ast` module to parse the source code and traverse the tree with a
visitor pattern. This is preferred because it's native to the language
itself, and Python developers are more likely to be familiar with it.
The traversal also handles nested scopes better than the prior
implementation. For example, classes that are declared inside of other
classes can now be looked up even though they don't exist at the top
level of the module namespace, since any time a class definition is
entered, that class is pushed to the top of a stack that can be examined
when visiting inner classes.
This also adds lots of log messages at different levels, plus a command
line argument for specifying verbosity, which should help with debugging
down the line.
This adds a script and GitHub action to the `test` directory that
dynamically imports all modules in `volatility3`, searches for usages of
`VersionableInterface` objects within classes that inherit from
`ConfigurableInterface` but don't enumerate the used component as a
requirement in `get_requirements()`, and returns -1 if any violations
are found.
Fixes
Replaced `member_type.vol.object_class == objects.Pointer` with `isinstance(member_type, objects.Pointer)`
to identify pointer types consistently. Thanks to @ikelos for the suggestion!
Previously, `getattr(volobject, member)` in `display_type()` would incorrectly
retrieve method references (e.g., `.write`) instead of the intended object
addresses, causing an `AttributeError` when `_display_value()` attempted to
access `.vol.offset`.
This commit replaces `getattr(volobject, member)` with `volobject.member(member)`,
ensuring that the correct object address is retrieved instead of method references.
Fixes: #1705
Details:
Implements exception handling for InvalidAddressException in volshell.
Ensures invalid pointers don't cause large stack traces, displaying "N/A" instead.
- Introduced `_get_type_name_with_pointer` to properly display pointer types.
- Enhanced `display_type` to follow and display pointer chains up to `MAX_DEREFERENCE_COUNT` levels.
- Added `_display_simple_type` to standardize type information display.
- Improved `_display_value` to highlight null and unreadable pointers.