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

Add process scanning, implement it on Linux and Windows #88

Merged
merged 14 commits into from
Dec 1, 2023
Merged

Conversation

vthib
Copy link
Owner

@vthib vthib commented Nov 17, 2023

First draft of process scanning. Implemented on linux and windows. Not exposed for the moment as it still needs some work.

@vthib vthib force-pushed the memory-trait branch 2 times, most recently from 1ee5a21 to a1219cc Compare November 17, 2023 19:30
@vthib
Copy link
Owner Author

vthib commented Nov 22, 2023

The linux32 conformance test fail was a bit of a pain to track down, but the fix is in review on YARA's side: VirusTotal/yara#2005

vthib added a commit to vthib/yara-rust that referenced this pull request Nov 22, 2023
vthib added a commit to vthib/yara-rust that referenced this pull request Nov 23, 2023
@vthib vthib force-pushed the memory-trait branch 3 times, most recently from aba43e3 to 4f38334 Compare November 30, 2023 00:01
@vthib vthib force-pushed the memory-trait branch 2 times, most recently from 6d2b6b7 to b2f371e Compare November 30, 2023 00:24
vthib added 14 commits November 30, 2023 22:58
This will make it possible to implement this trait differently for each
OS handling process scanning.
Make it possible to return None when fetching memory. This could have
been a Result as well, but the error would have just been ignored.

Another possiblity I played with was returning two kinds of errors,
either recoverable (we keep scanning) or unrecoverable (we abort the
scan). This is however a bit shaky on the semantics, since during
evaluation, we may fetch regions, but we have no way of bubbling up the
unrecoverable error in that case.

So for the moment, just use an Option. If a more complex usecase arises
in the future, this could change.
Instead of listing every region at the start, and then fetching them,
reduce the time between the listing of one region and its fetch.
This is useful as regions of a live process can change size, and if
the size becomes smaller, the read can entirely fail (this happens
on windows for example).
Add a new crate used for process scanning tests. This will allow much
more freedom on how to write those tests, and will avoid issues related
to self scanning.

This binary is now used for some tests, and more are coming.
@vthib vthib merged commit 1c64437 into master Dec 1, 2023
9 checks passed
@vthib vthib deleted the memory-trait branch December 1, 2023 00:20
vthib added a commit to vthib/yara-rust that referenced this pull request Dec 9, 2023
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