From 0d3bc77bde05c5f90d18fca6ff1dca8cfb8c5750 Mon Sep 17 00:00:00 2001 From: Bryan Roe Date: Mon, 29 Jul 2019 23:37:29 -0700 Subject: [PATCH] Renamed win-info Added AV Info --- modules/{win-qfe.js => win-info.js} | 30 ++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) rename modules/{win-qfe.js => win-info.js} (55%) diff --git a/modules/win-qfe.js b/modules/win-info.js similarity index 55% rename from modules/win-qfe.js rename to modules/win-info.js index 9a97fcb..2067859 100644 --- a/modules/win-qfe.js +++ b/modules/win-info.js @@ -38,5 +38,33 @@ function qfe() } return (result); } +function av() +{ + var child = require('child_process').execFile(process.env['windir'] + '\\System32\\wbem\\wmic.exe', ['wmic', '/Namespace:\\\\root\\SecurityCenter2', 'Path', 'AntiVirusProduct', 'get', '/FORMAT:CSV']); + child.stdout.str = ''; child.stdout.on('data', function (c) { this.str += c.toString(); }); + child.waitExit(); -module.exports = qfe; \ No newline at end of file + var lines = child.stdout.str.trim().split('\r\n'); + var keys = lines[0].split(','); + var i, key; + var tokens; + var result = []; + + for (i = 1; i < lines.length; ++i) + { + var obj = {}; + var status = {}; + tokens = lines[i].split(','); + for (key = 0; key < keys.length; ++key) + { + if (tokens[key] != undefined) { obj[keys[key].trim()] = tokens[key]; } + } + status.product = obj.displayName; + status.updated = (parseInt(obj.productState) & 0x10) == 0; + status.enabled = (parseInt(obj.productState) & 0x1000) == 0x1000; + result.push(status); + } + return (result); +} + +module.exports = { qfe: qfe, av: av } \ No newline at end of file