-
Notifications
You must be signed in to change notification settings - Fork 14.8k
modules/post/windows/gather/checkvm.rb improvement suggestions #18149
Description
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 0is 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.