Add --processes flag to scan active process commands#469
Merged
egibs merged 6 commits intochainguard-dev:mainfrom Sep 25, 2024
Merged
Add --processes flag to scan active process commands#469egibs merged 6 commits intochainguard-dev:mainfrom
egibs merged 6 commits intochainguard-dev:mainfrom
Conversation
Signed-off-by: egibs <20933572+egibs@users.noreply.github.com>
Signed-off-by: egibs <20933572+egibs@users.noreply.github.com>
bc7fa9d to
709b6a9
Compare
Signed-off-by: egibs <20933572+egibs@users.noreply.github.com>
fa9829a to
ca38615
Compare
Signed-off-by: egibs <20933572+egibs@users.noreply.github.com>
ca38615 to
02cd271
Compare
Signed-off-by: egibs <20933572+egibs@users.noreply.github.com>
Signed-off-by: egibs <20933572+egibs@users.noreply.github.com>
tstromberg
approved these changes
Sep 25, 2024
egibs
added a commit
to egibs/malcontent
that referenced
this pull request
Sep 25, 2024
) * Add --processes flag to scan active process commands Signed-off-by: egibs <20933572+egibs@users.noreply.github.com> * Fix Linux ps command Signed-off-by: egibs <20933572+egibs@users.noreply.github.com> * Avoid generating a report for malcontent when running a scan Signed-off-by: egibs <20933572+egibs@users.noreply.github.com> * Use gopsutil instead of parsing ps Signed-off-by: egibs <20933572+egibs@users.noreply.github.com> * Appease the linter Signed-off-by: egibs <20933572+egibs@users.noreply.github.com> * Re-add unique path functionality Signed-off-by: egibs <20933572+egibs@users.noreply.github.com> --------- Signed-off-by: egibs <20933572+egibs@users.noreply.github.com>
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 adds the ability to scan the [unique] commands of running processes if the command is a valid, absolute path.
go-yaraprovides aScanProcmethod; however, it was proving difficult to use (at least on MacOS where SIP may be a contributing factor), so this implementation focuses on the binaries of running processes which is actually easier to fit into our current scan pattern (loading file descriptors).To support the scanning of several hundred process paths, I had to track down and address a bug with the
scanPathFindingssync.Map. We were not removing keys as they were used so we'd endlessly iterate through them as the Map elements grew. This wasn't originally apparent because we would provide a single scan path (even if it was a directory).Finally, I also fixed the brief terminal output and made it a bit easier to read when accounting for multiple lines:
