[osquerybeat] Amcache osquery extension#46996
Conversation
🤖 GitHub commentsExpand to view the GitHub comments
Just comment with:
|
|
This pull request does not have a backport label.
To fixup this pull request, you need to add the backport labels for the needed
|
|
This pull request is now in conflicts. Could you fix it? 🙏 |
|
I created a branch with a combined table I also created a VIEW that joins the two application tables and presents a single table. CREATE VIEW amcache_applications as SELECT * FROM amcache_application_file JOIN amcache_application using (program_id);I then ran a few queries with the performance timer turned on to see how the three scenarios compared (prebuilt combined table, view, manual joins). Here are the results Scenario: Select 10 entries
Scenario: Select all entries with a WHERE clause
In each case, the best overall performer was the VIEW table. I think this is the best solution as well because it means less processing and overhead on our side, but also a more convenient interface for the customer. I have added a view creator to the extension in this PR. |
|
@andrewkroh I have responded to the feedback and made requested changes. For the ones I didn't address, I responded with questions
I want to provide a bit more information about the added dependencies Background Info
github.com/forensicanalysis/fslibLicenseDescriptionThis library allows for low level reads of files, by parsing the mft and reading the raw bytes. This allows us to bypass the security around the amcache hive and read it directly from disk. This is the standard tactic for other amcache tools as well. Reasoning for inclusionThe functionality that it provides is non-trivial and would be a significant effort to reproduce www.velocidex.com/golang/regparserLicenseDescriptionThis library is the only offline registry parsing library I was able to find. Due to the unique way we have to get at the amcache hive, this is necessary to parse the file after we acquire it Reasoning for inclusionAgain, the functionality that it provides is non-trivial and would be a significant effort to reproduce |
x-pack/osquerybeat/ext/osquery-extension/pkg/amcache/state/state.go
Outdated
Show resolved
Hide resolved
x-pack/osquerybeat/ext/osquery-extension/pkg/amcache/state/state.go
Outdated
Show resolved
Hide resolved
x-pack/osquerybeat/ext/osquery-extension/pkg/amcache/state/state.go
Outdated
Show resolved
Hide resolved
x-pack/osquerybeat/ext/osquery-extension/pkg/amcache/tables/tables.go
Outdated
Show resolved
Hide resolved
x-pack/osquerybeat/ext/osquery-extension/pkg/amcache/tables/tables.go
Outdated
Show resolved
Hide resolved
x-pack/osquerybeat/ext/osquery-extension/pkg/amcache/tables/tables.go
Outdated
Show resolved
Hide resolved
x-pack/osquerybeat/ext/osquery-extension/pkg/amcache/state/state_test.go
Outdated
Show resolved
Hide resolved
x-pack/osquerybeat/ext/osquery-extension/pkg/amcache/state/state.go
Outdated
Show resolved
Hide resolved
x-pack/osquerybeat/ext/osquery-extension/pkg/amcache/tables/tables.go
Outdated
Show resolved
Hide resolved
x-pack/osquerybeat/ext/osquery-extension/pkg/amcache/registry/registry.go
Outdated
Show resolved
Hide resolved
x-pack/osquerybeat/ext/osquery-extension/pkg/amcache/registry/registry.go
Outdated
Show resolved
Hide resolved
x-pack/osquerybeat/ext/osquery-extension/pkg/amcache/amcache.go
Outdated
Show resolved
Hide resolved
x-pack/osquerybeat/ext/osquery-extension/pkg/amcache/amcache.go
Outdated
Show resolved
Hide resolved
|
Failed test is unrelated to this PR, occurring in unrelated code. I made a flaky test issue for it: #47724 |
|
This pull request is now in conflicts. Could you fix it? 🙏 |
* amcache osquery extension initial work:wq! * individual tables * Shared global state, constraints * go mod/sum * Refactor + Tests * fix unused import * remove unecessary log statements * go mod tidy * remove unecessary file * formatting * Add detailed comments around Globalstate * feat: Implement encoding package with MarshalToMap and EncodingFlag support * fix: Update EncodingFlag constants and enhance tests for zero value handling * fix: Enhance float handling in convertValueToString to respect zero value flag * add view creator * fix main.go * fix main.go .. again * fix: Remove unused EncodingFlagParseUnexported and related test cases * debugging for agent package * refactor + view creator * changelog fragment * make amcache global state explicit, move view creator * fix state update omission * update NOTICE.txt * linting issues * amcache use filters * osquerybeat filters * notice update * changelog fragment * PR Feedback * remove newly added dependency * remove dependency * fix dependency * fix state test * PR feedback, reduce complexity * add driver_package table * filters from main * add hive recovery * update tests * update view code * linting * update view * lint fixes * formatting, documentation * fix undefined call * linting and struct fixes * goimports * PR Feedback, post hooks * add some hooks tests * restrict amcache.go to windows only * golint * hooks test formatting and remove unecessary test * remove unused import * more golint fixes * attempt to clean up views * fix nil dereference * golint fixes * add monitoring to other tests * golint fixes * prepend table names with elastic * PR Feedback part 1 * PR Feedback testdata refactor * PR feedback / gofumpt * PR Feedback, remove unecessary file * godoc update * update table information docs * PR Feedback - expiration timer * PR Feedback * lint fix * updating tests with PR feedback * PR Feedback * fix import * remove a fatal log * lint fix * fix incorrect assertion in unit test * resolve conflicts * rerun make notice * go mod tidy * update NOTICE.txt --------- Co-authored-by: Marc Guasch <marc.guasch@elastic.co> Co-authored-by: Emilio Alvarez Piñeiro <95703246+emilioalvap@users.noreply.github.com>
Proposed commit message
Adds the
amcachetable to the osquery extension packaged withosquerybeatSee further discussion: https://github.com/elastic/endpoint-dev/issues/17096
Checklist
CHANGELOG.next.asciidocorCHANGELOG-developer.next.asciidoc.Disruptive User Impact
None
Author's Checklist
How to test this PR locally
Related issues
Use cases
Screenshots
Logs