44 lines
1.0 KiB
Go
44 lines
1.0 KiB
Go
/*
|
|
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
|
|
}
|