Envars listing addition + Macos process filtering enhanced.#7
Open
forensicxlab wants to merge 3 commits intomemflow:mainfrom
Open
Envars listing addition + Macos process filtering enhanced.#7forensicxlab wants to merge 3 commits intomemflow:mainfrom
forensicxlab wants to merge 3 commits intomemflow:mainfrom
Conversation
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR implements the process environment APIs (
envar_list_callback,environment_block_address,envar_list_from_address) across all native backends and aligns behavior between platforms.Windows: Envars are collected via
sysinfo(Process::environ()) and parsed.Linux: Envars are collected from
/proc/<pid>/environand parsed.MacOs: Envars are collected by calling
sysctl(KERN_PROCARGS2)and parsed.It is linked to memflow PR and memflow-rawmem PR and memflow-win32
To build this PR for testing (Linux/MacOs/Windows)
Uncomment the following lines in
Cargo.tomlTesting on MacOs/Linux
Module listing (Now working on latest MacOS)
cd /TEST/PATH/memflow MEMFLOW_PLUGIN_PATH=/TEST/PATH/memflow-native/target/debug \ cargo run --example module_list -- --os native --process module_listEnvars
cd /TEST/PATH/memflow MEMFLOW_PLUGIN_PATH=FULL/PATH/TO/memflow-native/target/debug \ cargo run --example envars_list -- --os native --process envars_list --envar PATHTesting on windows 11 latest (PowerShell)
Envars
Fixes / enhancements
pidinfocall to use the target PID correctly (pidinfo(pid, 0)), instead of mixing caller/target args.read_procargs2/parse_procargs2) and used that for consistentpath/command_lineextraction.MacOs; buffer size now followsKERN_ARGMAX.MacProcess::try_newno longer hard-fails iftask_for_pidis denied; it creates a process with deferred port acquisition.For module enumeration I added a small improvement to get more results: kept dyld-based module enumeration as primary path which is working well. But we can also perform a fallback to region-based enumeration (
PROC_PIDREGIONPATHINFO) when dyld/task-port path fails. This worked well for process protected like GUI processes (Finder, Dock, loginwindow), where dyld/task-port path is unavailable.First contribution to this project, happy to follow your guidance on the implementation / things to correct.