Mini Kabibi Habibi

Current Path : C:/Program Files/McAfee/WebAdvisor/Analytics/Scripts/
Upload File :
Current File : C:/Program Files/McAfee/WebAdvisor/Analytics/Scripts/wmi.js

/*! $FileVersion=1.2.229 */ var wmi_fileVersion = "1.2.229"; 
function CreateWMIManger(){var a={_createAttribute:function(f,c){var g={_data:[],get:function(l,j){try{return l(this._data,j)}catch(k){return null}}};try{f.reset();var d=f.next();while(d){var h=d.get(c);g._data.push(h);d=f.next()}}catch(i){logDebug("failed to populate attribute object")}return g},_getMockIterator:function(){var c={reset:function(){logWarning("mockIterator: Calling reset(). noop")},next:function(){logWarning("mockIterator: Calling next(). Returning `null`");return null}};return c},_unavailableServers:{},resetAvailableServers:function(){this._unavailableServers={}},_getServer:function(g){try{if(this._unavailableServers[g]==true){return null}if(!g){return null}var c=this.getPlugin();if(!c){return null}var f=c.connectServer(g);if(f){return f}}catch(d){logError("_getServer: "+d.message)}this._unavailableServers[g]==true;return null},_queryWMIServer:function(h,d){try{if(!d||!h){return null}var g=this._getServer(h);if(!g){return this._getMockIterator()}var c=g.execQuery(d);c.reset();return c}catch(f){logError("_queryWMIServer: Failed due to "+f.message)}return null},_createCustomActions:function(d){var c={antimalware_status:function(e){return d._queryWmiSecurityCenter("AntiVirusProduct",e)},firewall_status:function(e){return d._queryWmiSecurityCenter("FirewallProduct",e)},firewall_enabled:function(){return d._checkWindowsFirewallEnabled()},oobe_time:function(f){var e=d._getOldestUserFolderCreationDate();return e?e.creationDate:null},disk_encryption:function(e){return d._checkDiskEncryption()},network_status:function(e){return d._checkForNetworkConnection()},vpn_names_list:function(f){var e="SELECT PNPDeviceID,Description FROM Win32_NetworkAdapter WHERE PNPDeviceID LIKE '%ROOT\\\\NET%'";return d._queryWMICIMV2ColumnAsList(e,"Description")},vpn_name_enabled_list:function(k){var j="SELECT Description FROM Win32_NetworkAdapterConfiguration where IPEnabled = True";var i=d._queryWMICIMV2ColumnAsList(j,"Description");var l=ModuleManager.getSingleton("data_collector");var f=l.get("device_vpn_names");var e=[];for(var h in f){for(var g in i){if(i[g]==f[h]){e.push(i[g])}}}return e}};return c},_createClassIterator:function b(d,e){var c={getAttribute:function(f){try{return this.attributeFactory(this._iterator,f)}catch(g){logDebug("_createClassIterator failed");return{get:function(){return null}}}},attributeFactory:e,_iterator:d};return c},getPlugin:function(){if(!this.wmiPlugin){this.wmiPlugin=getPluginFactory().Create("wmi")}return this.wmiPlugin},getClassIterator:function(c){var e=this._getServer("\\\\.\\Root\\CIMV2");var d=null;if(!e){d=this._getMockIterator()}else{d=e.execQuery("SELECT * FROM "+c)}return this._createClassIterator(d,this._createAttribute)},wmiPlugin:null,_customActions:null,preprocessors:{noop:function(c){return c},toInt:function(c){return parseInt(c,10)}},aggregators:{useFirst:function(c,d){try{return d(c[0])}catch(f){return null}},summation:function(c,d){try{var g=0;for(var f in c){g+=d(c[f])}return g}catch(h){return 0}},count:function(c,d){try{return c.length}catch(f){return 0}}},_queryWmiSecurityCenter:function(c,f){try{var k="SELECT displayName, productState FROM "+c;var i=this._queryWMIServer("\\\\.\\Root\\SecurityCenter2",k);var g={enabled:[],disabled:[]};var h=i.next();while(h){try{var l=h.get("displayName");var d=h.get("productState");var m=f.mask&parseInt(d,10);if(m&&!f.complement){g.enabled.push(l)}if(!m&&f.complement){g.disabled.push(l)}}catch(j){logError("dataset_content_metadata::_queryWmiSecurityCenter: Exception while retrieving the "+c+" state: "+j.message)}h=i.next()}}catch(j){logError("dataset_content_metadata::_queryWmiSecurityCenter: Excpetion caught with message: "+j.message);return null}return g},_sanitizePath:function(d,c,i){try{var h=getSystemPlugin().GetKnownFolder(d);if(c){h+="\\"+c}if(i){h+="\\"+i}var g=h.split("\\").join("\\\\");return g}catch(f){logError("_sanitizePath: Exception caught with message: "+f.message);return""}},_getTargetSanitizedPathCreationDate:function(i,f){try{if(!i){return null}if(f){var g='SELECT Name,CreationDate  FROM cim_datafile  WHERE  Name  = "'+i+'"'}else{var g='SELECT Name,CreationDate  FROM Win32_Directory  WHERE  Name  = "'+i+'"'}var c=this._queryWMICIMV2ColumnAsList(g,"CreationDate");if(!c){return null}var d=ModuleManager.getSingleton("operations");return d.stringToDate(c[0])}catch(h){logError("dataset_content_metadata::_getTargetSanitizedPathCreationDate { sanitiziedTargetPath: "+i+"} Exception caught with message: "+h.message);return null}},getTargetPathCreationDate:function(d){try{folderId=d.folderId;directory=d.directory;fileName=d.fileName;var f=this._sanitizePath(folderId,directory,fileName);return this._getTargetSanitizedPathCreationDate(f,(fileName?true:false))}catch(c){logError("dataset_content_metadata::_getTargetPathCreationDate { folderid: "+folderId+", directory: "+directory+"} Exception caught with message: "+c.message);return null}},_queryWMICIMV2ColumnAsList:function(h,d){try{var g=this._queryWMIServer("\\\\.\\Root\\CIMV2",h);var c=[];var f=g.next();while(f){c.push(f.get(d));f=g.next()}return c}catch(i){logError("_queryWMICIMV2ColumnAsList: Exception: "+i.message+" Query: "+h+" Column: "+d)}return[]},_getOldestUserFolderCreationDate:function(){try{var f=getSystemPlugin().GetKnownFolder("{0762D272-C50A-4BB0-A382-697DCD729B80}");var i="ASSOCIATORS OF {Win32_Directory.Name='"+f+"'} WHERE AssocClass = Win32_Subdirectory ResultRole = PartComponent";var l=this._queryWMICIMV2ColumnAsList(i,"Name");var j=null;var m=null;for(var k in l){var o=l[k];if(o.match("(all users|default|default user|public|default.migrated)$")){continue}logDebug("Path: "+o);var d=o.split("\\").join("\\\\");var g=this._getTargetSanitizedPathCreationDate(d);if(!g){continue}if(!j||(g<j)){logDebug("new minumum creation date for path: "+d);j=g;var c=o.split("\\");m=c[c.length-1]}}if(!j){logWarning("_getOldestUserFolderCreationDate: minimumCreationDate is null");return null}var n={usedPath:m,creationDate:j};return n}catch(h){logError("_getOldestUserFolderCreationDate: "+h.message)}},_checkForNetworkConnection:function(){var d="SELECT name, NetConnectionStatus FROM Win32_NetworkAdapter WHERE NetConnectionStatus =  2";var c=this._queryWMICIMV2ColumnAsList(d,"name");if(c&&(c.length!=0)){return true}return false},_checkDiskEncryption:function(){try{var i="\\\\.\\Root\\CIMV2\\SECURITY\\MICROSOFTVOLUMEENCRYPTION";var f=this._queryWMIServer(i,"SELECT * FROM Win32_EncryptableVolume");var c=f.next();if(!c){return null}var h=c.get("ProtectionStatus");var d=parseInt(h,10);return d}catch(g){logError("dataset_content_metadata::_checkDiskEncryption: Excpetion caught with message: "+g.message);return null}},_checkWindowsFirewallEnabled:function(){try{var d="SELECT Name, Enabled FROM MSFT_NetFirewallProfile";var g=this._queryWMIServer("\\\\.\\Root\\StandardCimv2",d);var i=false;if(g){var f=g.next();while(f){try{var j=f.get("Enabled");if(j===true||j==="True"||j===1){i=true}}catch(c){logDebug("Error processing firewall profile: "+c.message)}f=g.next()}if(i){return"enabled"}}logDebug("Windows Firewall not found or not enabled");return"disabled"}catch(h){logError("_checkWindowsFirewallEnabled: "+h.message);return"disabled"}},executeAction:function(d){try{if(!d){return null}if(!this._customActions){this._customActions=this._createCustomActions(this)}return this._customActions[d.action](d.data)}catch(c){logError("wmi:custom_actions: "+c.message+"datadefinition("+JSON.stringify(meta.action)+")")}return null},fetchFromDataDefinition:function(i){try{var c=this.getClassIterator(i.className);var f=c.getAttribute(i.column);var h=this.aggregators[i.aggregatorName];if(!h){h=this.aggregators.useFirst}var d=this.preprocessors[i.preprocessorName];if(!d){d=this.preprocessors.noop}return f.get(h,d)}catch(g){logError("wmi:fetchFromDataDefinition: "+g.message+"datadefinition("+JSON.stringify(i)+")")}}};setInterval(1*60*60*1000,function(){a.resetAvailableServers()});return a}ModuleManager.registerFactory("wmi",CreateWMIManger);
//7426D67305DA37AEA8EC580589D781A7BEBA55507CBF2A924C9E7D30AF71497B51464D2A7B8D97C28DFBD7B30232164B00ADC6846B4FBEA0377138DE7F87DA72++