Example #1
0
func getMemoryInfo() (memoryInfo map[string]string, err error) {
	memoryInfo = make(map[string]string)
	computerSystem, err := utils.WindowsWMICommand("COMPUTERSYSTEM", "TotalPhysicalMemory")
	if err != nil {
		return
	}
	memoryInfo["total"] = computerSystem["TotalPhysicalMemory"]

	return
}
Example #2
0
func getArchInfo() (systemInfo map[string]interface{}, err error) {
	systemInfo = make(map[string]interface{})

	computerSystem, err := utils.WindowsWMICommand("COMPUTERSYSTEM", "Name", "SystemType")
	if err != nil {
		return
	}
	systemInfo["hostname"] = computerSystem["Name"]
	systemInfo["machine"] = computerSystem["SystemType"]

	os, err := utils.WindowsWMICommand("OS", "Version", "Caption")
	if err != nil {
		return
	}
	systemInfo["kernel_release"] = os["Version"]
	systemInfo["os"] = os["Caption"]

	systemInfo["kernel_name"] = "Windows"

	return
}
Example #3
0
func getCpuInfo() (cpuInfo map[string]string, err error) {

	cpuInfo = make(map[string]string)

	cpu, err := utils.WindowsWMICommand("CPU",
		"CurrentClockSpeed", "Name", "NumberOfCores",
		"Caption", "Manufacturer")
	if err != nil {
		return
	}
	cpuInfo["mhz"] = cpu["CurrentClockSpeed"]
	cpuInfo["model_name"] = cpu["Name"]
	cpuInfo["cpu_cores"] = cpu["NumberOfCores"]
	cpuInfo["vendor_id"] = cpu["Manufacturer"]

	caption := fmt.Sprintf(" %s ", cpu["Caption"])
	cpuInfo["family"] = extract(caption, "Family")
	cpuInfo["model"] = extract(caption, "Model")
	cpuInfo["stepping"] = extract(caption, "Stepping")

	return
}