Skip to content

Commit 3d965cc

Browse files
committed
feat(envscan): 加上 Windows 的版本号
1 parent c916727 commit 3d965cc

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

envinspection/installed_software_windows.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"context"
77
"fmt"
88
"github.com/murphysecurity/murphysec/model"
9+
"golang.org/x/sys/windows"
910
"golang.org/x/sys/windows/registry"
1011
"path/filepath"
1112
)
@@ -47,6 +48,12 @@ func listSubKeys(ctx context.Context, key registry.Key, path string) ([]string,
4748
func listInstalledSoftwareWindows(ctx context.Context) ([]model.DependencyItem, error) {
4849
var rKeys = []registry.Key{registry.CURRENT_USER, registry.LOCAL_MACHINE}
4950
var r []model.DependencyItem
51+
r = append(r, model.DependencyItem{
52+
Component: model.Component{
53+
CompName: "Windows",
54+
CompVersion: fmt.Sprintf("%d.%d.%d", windows.RtlGetVersion().MajorVersion, windows.RtlGetVersion().MinorVersion, windows.RtlGetVersion().BuildNumber),
55+
},
56+
})
5057
for _, rKey := range rKeys {
5158
paths, e := listSubKeys(ctx, rKey, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall")
5259
if e != nil {

0 commit comments

Comments
 (0)