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

Rework internal Scanner/Evaluator API #81

Merged
merged 14 commits into from
Oct 23, 2023
Merged

Rework internal Scanner/Evaluator API #81

merged 14 commits into from
Oct 23, 2023

Conversation

vthib
Copy link
Owner

@vthib vthib commented Oct 22, 2023

Lots of changes that impact the internal API without any effect on the public API.
Those changes are made to prepare the scan of process memory.

The objects used between the scanner module and the evaluator module were kind of a mess.
This MR makes it cleaner, although not as clean as I would like. I think there is still
quite a room for improvement, but the new version at least will work relatively well
with the addition of another kind of "memory" to scan: a fragmented one, used to represent
the process memory.

This is useful to setup the data of a module, as the get_dynamic_values
method will now be called multiple times per scan.
Prepare for when it will be called multiple times.
ScanContext will be used when calling get_module_values, and will
contain a byte slice, as it will be recreated for every memory region.

EvalContext will be used when evaluating functions, and will contain the
Memory object.
Split how modules are handled with a ScanData and a ModulesData.
The first one needs to be built by scanning every region, and the second
one contains the immutable data that is needed to evaluate rules.
Add a ScanContext different from the one used during evaluation.
Additionally, internalize the parameters. This makes the ac_scan module
no longer dependent on types from the evaluation phase.
This is not used in the evaluator module, so remove it.
Move this outside of the ScanData object.
This ends the simplification by removing a lot of converting code.
@vthib vthib merged commit 796ec3b into master Oct 23, 2023
9 of 11 checks passed
@vthib vthib deleted the rework-api branch October 23, 2023 18:08
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

Successfully merging this pull request may close these issues.

1 participant