rmmagent/agent/software_windows_amd64.go

44 lines
1.0 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"
wapi "github.com/iamacarpet/go-win64api"
trmm "github.com/wh1te909/trmm-shared"
)
func (a *Agent) GetInstalledSoftware() []trmm.WinSoftwareList {
ret := make([]trmm.WinSoftwareList, 0)
sw, err := wapi.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
}