-
Notifications
You must be signed in to change notification settings - Fork 590
Feature/parquet arrow renderer #1861
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
Merged
ikelos
merged 22 commits into
volatilityfoundation:develop
from
kyrre:feature/parquet-arrow-renderer
Sep 15, 2025
Merged
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
50767ff
add arrow and parquet renderers
kyrre a0b0076
formatting with ruff
kyrre 1c78562
linting
kyrre 0389596
Fix: Avoid import-time errors if pyarrow is missing
machinelearningdesignpatterns 78d5653
fix: handle layerdata to pyarrow conversion
machinelearningdesignpatterns d3a6b03
moved arrow/parquet parsers to it's own file and reverted changes
machinelearningdesignpatterns 8479fa1
moved renderer parsing to after the plugins are imported
machinelearningdesignpatterns 066076b
black formatting
machinelearningdesignpatterns 0f32bec
restore orginal text_renderer
machinelearningdesignpatterns 72422d0
fix bug: hadn't properly renamed the write_data method name
machinelearningdesignpatterns e7c1126
moved the arrow/parquet renderers to a subdir for renderers
machinelearningdesignpatterns 6437148
remove old parquet renderer
machinelearningdesignpatterns 11b3123
fix: update data type mappings for format_hints.Bin and format_hints.…
machinelearningdesignpatterns 533b305
Added tests for the Parquet and Arrow renderers
machinelearningdesignpatterns eb7daa9
flatten tree output
machinelearningdesignpatterns 3c830e6
black & ruff
machinelearningdesignpatterns d21a81d
fix: update type hints to support Python 3.8
machinelearningdesignpatterns 86fe448
Update volatility3/framework/plugins/renderers/parquet_renderer.py
kyrre 4c7a9b5
Update volatility3/framework/plugins/renderers/parquet_renderer.py
kyrre 4af48ae
Update volatility3/framework/plugins/renderers/parquet_renderer.py
kyrre 8090d72
Update volatility3/framework/plugins/renderers/parquet_renderer.py
kyrre 81f2e73
Update test/renderers/test_parquet_renderers.py
ikelos 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
Empty file.
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 |
---|---|---|
@@ -0,0 +1,109 @@ | ||
import io | ||
import pytest | ||
from abc import ABC, abstractmethod | ||
from test import test_volatility | ||
|
||
HAS_PYARROW = False | ||
try: | ||
import pyarrow as pa | ||
import pyarrow.parquet as pq | ||
import pyarrow.compute as pc | ||
HAS_PYARROW = True | ||
except ImportError: | ||
ikelos marked this conversation as resolved.
Show resolved
Hide resolved
|
||
# The user doesn't have pyarrow installed, but HAS_PYARROW will be false so just continue | ||
pass | ||
|
||
|
||
@pytest.mark.skipif(not HAS_PYARROW, reason="pyarrow not installed") | ||
class TestArrowRendererBase(ABC): | ||
"""Base class for testing Arrow-based renderers. | ||
|
||
Re-implements Windows and Linux plugin tests using PyArrow operations | ||
instead of text-based assertions. | ||
""" | ||
|
||
renderer_format = None # Override in subclasses | ||
|
||
@abstractmethod | ||
def _get_table_from_output(self, output_bytes) -> "pa.Table": | ||
"""Parse output bytes into Arrow table. Override in subclasses.""" | ||
|
||
def test_windows_generic_pslist(self, volatility, python, image): | ||
rc, out, _err = test_volatility.runvol_plugin( | ||
"windows.pslist.PsList", | ||
image, | ||
volatility, | ||
python, | ||
globalargs=("-r", self.renderer_format), | ||
) | ||
assert rc == 0 | ||
|
||
table = self._get_table_from_output(out) | ||
assert table.num_rows > 10 | ||
|
||
assert table.filter(pc.match_substring(pc.utf8_lower(table.column('ImageFileName')), "system")).num_rows > 0 | ||
assert table.filter(pc.match_substring(pc.utf8_lower(table.column('ImageFileName')), "csrss.exe")).num_rows > 0 | ||
assert table.filter(pc.match_substring(pc.utf8_lower(table.column('ImageFileName')), "svchost.exe")).num_rows > 0 | ||
assert table.filter(pc.greater(table.column('PID'), 0)).num_rows == table.num_rows | ||
|
||
def test_linux_generic_pslist(self, volatility, python, image): | ||
rc, out, _err = test_volatility.runvol_plugin( | ||
"linux.pslist.PsList", | ||
image, | ||
volatility, | ||
python, | ||
globalargs=("-r", self.renderer_format), | ||
) | ||
assert rc == 0 | ||
|
||
table = self._get_table_from_output(out) | ||
assert table.num_rows > 10 | ||
|
||
init_rows = table.filter(pc.match_substring(pc.utf8_lower(table.column('COMM')), "init")) | ||
systemd_rows = table.filter(pc.match_substring(pc.utf8_lower(table.column('COMM')), "systemd")) | ||
assert (init_rows.num_rows > 0) or (systemd_rows.num_rows > 0) | ||
|
||
assert table.filter(pc.match_substring(pc.utf8_lower(table.column('COMM')), "watchdog")).num_rows > 0 | ||
assert table.filter(pc.greater(table.column('PID'), 0)).num_rows == table.num_rows | ||
|
||
def test_windows_generic_handles(self, volatility, python, image): | ||
rc, out, _err = test_volatility.runvol_plugin( | ||
"windows.handles.Handles", | ||
image, | ||
volatility, | ||
python, | ||
globalargs=("-r", self.renderer_format), | ||
pluginargs=("--pid", "4"), | ||
) | ||
assert rc == 0 | ||
|
||
table = self._get_table_from_output(out) | ||
assert table.num_rows > 500 | ||
assert table.filter(pc.match_substring(pc.utf8_lower(table.column('Name')), "machine\\system")).num_rows > 0 | ||
|
||
def test_linux_generic_lsof(self, volatility, python, image): | ||
rc, out, _err = test_volatility.runvol_plugin( | ||
"linux.lsof.Lsof", | ||
image, | ||
volatility, | ||
python, | ||
globalargs=("-r", self.renderer_format), | ||
) | ||
assert rc == 0 | ||
|
||
table = self._get_table_from_output(out) | ||
assert table.num_rows > 35 | ||
|
||
class TestParquetRenderer(TestArrowRendererBase): | ||
renderer_format = "parquet" | ||
|
||
def _get_table_from_output(self, output_bytes): | ||
return pq.read_table(io.BytesIO(output_bytes)) | ||
|
||
|
||
class TestArrowRenderer(TestArrowRendererBase): | ||
renderer_format = "arrow" | ||
|
||
def _get_table_from_output(self, output_bytes): | ||
return pa.ipc.open_stream(io.BytesIO(output_bytes)).read_all() | ||
|
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.