add graphics info

This commit is contained in:
wh1te909 2021-04-10 23:43:44 -07:00
parent aa44cb2dc8
commit 1b0faff813
2 changed files with 62 additions and 0 deletions

View File

@ -476,6 +476,34 @@ func GetWin32_BaseBoard() ([]interface{}, error) {
return ret, nil
}
func GetWin32_VideoController() ([]interface{}, error) {
var dst []rmm.Win32_VideoController
ret := make([]interface{}, 0)
q := wmi.CreateQuery(&dst, "")
err := wmi.Query(q, &dst)
if err != nil {
return ret, err
}
for _, val := range dst {
b, err := json.Marshal(val)
if err != nil {
return ret, err
}
// this creates an extra unneeded array but keeping for now
// for backwards compatibility with the python agent
tmp := make([]interface{}, 0)
var un map[string]interface{}
if err := json.Unmarshal(b, &un); err != nil {
return ret, err
}
tmp = append(tmp, un)
ret = append(ret, tmp)
}
return ret, nil
}
func (a *WindowsAgent) GetWMI() {
wmiInfo := make(map[string]interface{})
@ -539,6 +567,11 @@ func (a *WindowsAgent) GetWMI() {
a.Logger.Debugln(err)
}
graphics, err := GetWin32_VideoController()
if err != nil {
a.Logger.Debugln(err)
}
wmiInfo["comp_sys_prod"] = compSysProd
wmiInfo["comp_sys"] = compSys
wmiInfo["network_config"] = netAdaptConfig
@ -551,6 +584,7 @@ func (a *WindowsAgent) GetWMI() {
wmiInfo["desktop_monitor"] = desktopMon
wmiInfo["cpu"] = cpu
wmiInfo["usb"] = usb
wmiInfo["graphics"] = graphics
payload := map[string]interface{}{"agent_id": a.AgentID, "sysinfo": wmiInfo}

View File

@ -854,3 +854,31 @@ type Win32_USBController struct {
SystemName string
TimeOfLastReset time.Time
}
type Win32_VideoController struct {
AcceleratorCapabilities []string
AdapterCompatibility string
AdapterDACType string
AdapterRAM uint32
Availability uint16
CapabilityDescriptions []string
Caption string
CurrentRefreshRate uint32
CurrentVerticalResolution uint32
Description string
DeviceID string
DriverDate time.Time
DriverVersion string
InstallDate time.Time
InstalledDisplayDrivers string
MaxMemorySupported uint32
MaxRefreshRate uint32
MinRefreshRate uint32
Name string
Status string
SystemCreationClassName string
SystemName string
TimeOfLastReset time.Time
VideoModeDescription string
VideoProcessor string
}