Skip to content

modules/post/windows/gather/checkvm.rb improvement suggestions #18149

@bwatters-r7

Description

@bwatters-r7

This is related to the PR #18140

While reviewing the PR, we established that the changes were good and we wanted to bring them in, but that the underlying module has had so much bolted on over time that it is a bit kludgy and could be vastly streamlined and improved.

Specifically, it seems like over time, developers have just added return true if condition is met in each instance. While it is good we bail as soon as we find evidence, there are also several times we query the same registry key ot call the same command multiple times. Also, some of the methods defined in the module already appear to exist elsewhere.
For example:

  • service_exists? is already in the windows service post library

  • HKLM\HARDWARE\DEVICEMAP\Scsi\Scsi Port 0\Scsi Bus 0 is queried repeatedly for different vm fingerprints, each compared to something else.

  • I don't see any controlling for registry redirection, though I admit, I don't know if it matters in this case

  • It might be nice to know that we're running in a sandbox in a virtual environment, so the current setup that only a sandbox or a vm could be reported seems limiting.

@smcintyre-r7 @jmartin-r7 @cdelafuente-r7

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions