rmmagent/agent/software_windows_386.go

54 lines
1.3 KiB
Go
Raw Normal View History

2022-03-19 18:55:43 +00:00
/*
Copyright 2022 AmidaWare LLC.
Licensed under the Tactical RMM License Version 1.0 (the License).
You may only use the Licensed Software in accordance with the License.
A copy of the License is available at:
https://license.tacticalrmm.com
*/
package agent
import (
"fmt"
so "github.com/iamacarpet/go-win64api/shared"
wapf "github.com/wh1te909/go-win64api"
trmm "github.com/wh1te909/trmm-shared"
)
func installedSoftwareList() ([]so.Software, error) {
sw32, err := wapf.GetSoftwareList(`SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall`, "X32")
if err != nil {
return nil, err
}
return sw32, nil
}
func (a *Agent) GetInstalledSoftware() []trmm.WinSoftwareList {
ret := make([]trmm.WinSoftwareList, 0)
sw, err := installedSoftwareList()
if err != nil {
return ret
}
for _, s := range sw {
t := s.InstallDate
ret = append(ret, trmm.WinSoftwareList{
Name: CleanString(s.Name()),
Version: CleanString(s.Version()),
Publisher: CleanString(s.Publisher),
InstallDate: fmt.Sprintf("%02d-%d-%02d", t.Year(), t.Month(), t.Day()),
Size: ByteCountSI(s.EstimatedSize * 1024),
Source: CleanString(s.InstallSource),
Location: CleanString(s.InstallLocation),
Uninstall: CleanString(s.UninstallString),
})
}
return ret
}