Mini Kabibi Habibi

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

/*! $FileVersion=1.2.229 */ var common_fileVersion = "1.2.229"; 
if(typeof JSON!=="object"){LoadScript("json2.js")}if(typeof enableAnalyticsSDKForUWP==="undefined"){enableAnalyticsSDKForUWP=false}var GetEngineSetting=function(b,a){return a};if(typeof GetSetting==="function"){GetEngineSetting=GetSetting}else{logInformation("Missing GetSetting function; will only use default settings (this is expected pre SDK.2.3)")}var GetEngineProperty=function(b,a){return a};if(typeof GetProperty==="function"){GetEngineProperty=GetProperty}else{logInformation("Missing GetProperty function; will only use default Properties (this is expected pre SDK.2.5)")}if(!enableAnalyticsSDKForUWP){LoadScript("logging.js")}var getSystemPlugin=function(){var a=getScriptVariableStore().Get("system");if(!a){a=getPluginFactory().Create("system");getScriptVariableStore().Set("system",a)}return a};Date.prototype.toISOString=function(a){try{function d(f){var e=String(f);if(e.length===1){e="0"+e}return e}var b=this.getUTCFullYear()+"-"+d(this.getUTCMonth()+1)+"-"+d(this.getUTCDate());if(a){return b}b+="T"+d(this.getUTCHours())+":"+d(this.getUTCMinutes())+":"+d(this.getUTCSeconds())+"Z";return b}catch(c){return null}};if(!Date.prototype.toISOStringms){(function(){function b(c){if(c<10){return"0"+c}return c}try{Date.prototype.toISOStringms=function(){return this.getUTCFullYear()+"-"+b(this.getUTCMonth()+1)+"-"+b(this.getUTCDate())+"T"+b(this.getUTCHours())+":"+b(this.getUTCMinutes())+":"+b(this.getUTCSeconds())+"."+(this.getUTCMilliseconds()/1000).toFixed(3).slice(2,5)+"Z"}}catch(a){return null}})()}var dateToMfeString=function(b){try{function d(f){var e=String(f);if(e.length===1){e="0"+e}return e}var a=b.getUTCFullYear()+d(b.getUTCMonth()+1)+d(b.getUTCDate());return a}catch(c){return null}};function isoDateToDate(f){try{if(!f||(8>f.length)){return null}var d=parseInt(f.substr(0,4),10);var h=parseInt(f.substr(5,2),10);var b=parseInt(f.substr(8,2),10);var a=parseInt(f.substr(11,2),10);var i=parseInt(f.substr(14,2),10);var c=parseInt(f.substr(17,2),10);if(!d||!h||!b){return null}a=isNaN(a)?0:a;i=isNaN(i)?0:i;c=isNaN(c)?0:c;return new Date(Date.UTC(d,h-1,b,a,i,c))}catch(g){logWarning("isoDateToDate: exception caught with message: "+g.message);return null}}function isFirstFileVersionGreater(f,c){if(!f||!c){return true}try{var b=f.split(",");var i=c.split(",");if(b.length!=i.length){logWarning("isFirstFileVersionGreater: Could not compare versions with unequal length");return false}for(var d in b){var a=parseInt(b[d],10);var h=parseInt(i[d],10);if(isNaN(a)||isNaN(h)){logWarning("isFirstFileVersionGreater: Could not compare non-numerics file versions");return false}else{if(a==h){continue}else{if(a<h){return false}else{return true}}}}}catch(g){logWarning("isFirstFileVersionGreater: Failed due to "+g.message)}return false}function findObjectSize(c){if(!c){return 0}var b=0;for(var a in c){if(c.hasOwnProperty(a)){b+=1}}return b}function updateStringWithReplacement(b,a,c){try{return b.replace(a,c)}catch(d){logError("updateStringWithReplacement: Exception caught with message: "+d.message);return b}}function sanitizeJSONData(c){try{var f=JSON.parse(c);var a={};for(var b in f){a[b.toLowerCase()]=f[b]}return a}catch(d){logError("sanitizeEventData Exception caught with message: "+d.message);return null}}function generateAlphaNumericString(d){var a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";var b="";for(var c=0;c<d;c++){var e=Math.floor(Math.random()*a.length);b+=a[e]}return b}if(typeof __wrapPluginFactory!=="function"){function __wrapPluginFactory(a){var b={CreateFromGuid:function(d,f){var e="HKCR\\CLSID\\"+d;var c=ModuleManager.getSingleton("registry");if(!c.openKey(e)){logWarning("CreateFromGuid: could not open hive "+e);return null}if(!c.queryValue("")){logWarning("CreateFromGuid: could not open path "+e);return null}return this._plugin.CreateFromGuid(d,f!=false)},Create:function(f){if(!this._plugin){logError("PluginFactory: Native plugin factory is null");return null}var d=new Date().getTime();var e=this._plugin.Create(f);var c=new Date().getTime();var g=c-d;if(!e){logWarning("PluginFactory: Failed to create plugin: "+f+" - returned null (took "+g+"ms)")}return e},_plugin:a,_version:(a?parseInt(a.GetVersion(),10):0)};if(!a){logError("null pluginfactory, wrapping in a null-implementation")}return b}var __bootPluginFactory=getPluginFactory;getPluginFactory=function(){return __wrapPluginFactory(__bootPluginFactory())}}if(typeof __wrapMsgBusPlugin!=="function"){function __wrapMsgBusPlugin(a){var b={GetName:function(){return(this.IsAvailable()?this._plugin.GetName():"msgbus")},GetVersion:function(){return String(this._version)},Initialize:function(c){return(this.IsAvailable()?this._plugin.Initialize(c):true)},Publish:function(c,d){return(this.IsAvailable()?this._plugin.Publish(c,d):true)},Subscribe:function(c){return(this.IsAvailable()?this._plugin.Subscribe(c):true)},Unsubscribe:function(c){return(this.IsAvailable()?this._plugin.Unsubscribe(c):true)},Request:function(c,d){return((this.IsAvailable()&&(this._version>=2))?this._plugin.Request(c,d):true)},IsAvailable:function(){return((this._plugin&&(this._version>=3))?this._plugin.IsAvailable():(null!=this._plugin))},_plugin:a,_version:(a?parseInt(a.GetVersion(),10):0)};if(!a){logError("null msgbug plugin, wrapping in a null-implementation")}return b}var __bootGetMessageBus=getMessageBus;getMessageBus=function(){return __wrapMsgBusPlugin(__bootGetMessageBus())}}var dataManipulator={mergeAndLowerDictionary:function(b,c){if(!b||!c){return}for(var a in c){b[a.toLowerCase()]=c[a]}},mergeDictionary:function(b,c){if(!b||!c){return}for(var a in c){b[a]=c[a]}},arrayRemoveDuplicates:function(e){if(typeof e==="Array"){var b=e.filter(function(h,g,f){return g==f.indexOf(h)});return b}else{if(typeof e==="object"){var b=[];var c={};for(var a=0;a<e.length;++a){c[e[a]]=0}for(var d in c){b.push(d)}return b}}return e}};function CreateModuleManager(a){var b={getSingleton:function(d){var c=this._objects[d];if(c){return c}c=this.create(d);this._objects[d]=c;return c},create:function(d){var c=this._factoryManager.get(d);if(!c){logError("ModuleManager.create failed: "+d);return null}return new c()},set:function(d,c){this._objects[d]=c},_objects:{},registerFactory:function(d,c){this._factoryManager.register(d,c)},setScriptFileMapping:function(c,d){this._factoryManager.setScriptFileMapping(c,d)},_factoryManager:a};return b}function CreateJSONManager(){var a={getSingleton:function(d,b){var c=this._objects[d];b=(typeof b!=="undefined")?b:false;if(!b&&c){return c}c=this.create(d);this.set(d,c);return c},create:function(b){var f=this._getFileName(b);var c=scriptHelper._readRawText(f);if(!c){return null}try{return JSON.parse(c)}catch(d){logError("Failed to load JSON object '"+b+"' from file '"+f+"': exception is "+d.message)}return null},set:function(c,b){this._objects[c]=b},_objects:{},setJSONFileMapping:function(b,c){this._fileNameOverrides[b]=c},_getFileName:function(b){var c=this._fileNameOverrides[b];if(c){return c}return this._getfileNameDefault(b)},_getfileNameDefault:function(b){return b+".json"},_fileNameOverrides:{}};return a}function CreateFactoryManager(){var a={get:function(c){var b=this._factoryFunctions[c];if(b){return b}LoadScript(this._getScriptName(c));b=this._factoryFunctions[c];if(!b){logError("attempted to load "+c+" from file: "+this._getScriptName(c)+", however, it didn't register properly with ModuleManager")}return b},register:function(c,b){this._factoryFunctions[c]=b},setScriptFileMapping:function(b,c){this._scriptNameOverrides[b]=c},_getScriptName:function(b){var c=this._scriptNameOverrides[b];if(c){return c}return this._getscriptNameDefault(b)},_getscriptNameDefault:function(b){return b+".js"},_factoryFunctions:{},_scriptNameOverrides:{}};return a}function CreatePDManager(){var a={get:function(b){try{if(engine.aleStaticInegration()){logWarning("Product Definition Manager is not available");return null}var d=getMessageBus().Request("PDMgr.PDSettings.Request",b);var c=this._parsePDManagerResponse(d);if(!c){this._logError("get: No valid parsable response ("+d+").");return null}if(typeof(c.value)!="string"){return null}return c.value}catch(f){this._logError("get:"+f.message)}},_parsePDManagerResponse:function(c){var b=JSON.parse(c);if(b.error){this._logError("_parsePDManagerResponse: Failed to get response: "+b.error);return null}return b.payload},_logInfo:function(b){logInformation("PDManager:"+b)},_logError:function(b){logError("PDManager:"+b)}};return a}function CreateStorageManager(){var a={get:function(d){try{if(engine.aleStaticInegration()){logWarning("Settings Manager is not available");return null}if(typeof d!="string"){this._logError("get: expected a string value. Actual value("+d+")");return}var f={name:d};var c=getMessageBus().Request("SETTINGS_MANAGER_GET_PROPERTY",JSON.stringify(f));var b=this._parseSettingsManagerResponse(c);if(!b){this._logError("get: No valid parsable response ("+c+").");return null}if(typeof(b.value)!="string"){return null}return b.value}catch(g){this._logError("get:"+g.message)}},set:function(d,g,b){try{if(engine.aleStaticInegration()){logWarning("Settings Manager is not available");return}var f={name:d,value:g,"volatile":b};var c=getMessageBus().Publish("SETTINGS_MANAGER_SET_PROPERTY",JSON.stringify(f))}catch(h){this._logError("set: "+h.message)}},remove:function(c){try{var d={name:c};var b=getMessageBus().Publish("SETTINGS_MANAGER_REMOVE_PROPERTY",JSON.stringify(d))}catch(f){this._logError("remove:"+f.message)}},_parseSettingsManagerResponse:function(c){var b=JSON.parse(c);if(b.error){this._logError("_parseSettingsManagerResponse: Failed to get response: "+b.error);return null}return b.payload},_logInfo:function(b){logInformation("StorageManager:"+b)},_logError:function(b){logError("StorageManager:"+b)}};return a}function getDaSender(b){try{var a=getScriptVariableStore().Get("da");if(a){if(b!==true){return a}a.UnInitialize();a=null;getScriptVariableStore().Set("da",a);try{CollectGarbage(true)}catch(c){}}a=getPluginFactory().Create("da");getScriptVariableStore().Set("da",a);return a}catch(c){logWarning("getDaSender: Exception caught with message: "+c.message)}return null}var __geoInfo={queryDate:null,geoid:null,isQA:null,retry:5,maxPeriod:19};function getRandTimeBetween(b,a){return Math.floor(Math.random()*(a-b+1))+b}function isGeoidNumbers(a){var b=/\d+?/g;var c=b.exec(a);return c!=null}function queryGeoInfo(b){var g=null;var k="";var i=null;var f=null;var h=null;if(b==null){var k="https://prd-mcafee-mosaic-pub.azurewebsites.net/api/geoiplookup?code=rXirGSARC5aMI8vaT2FIgrd9xrI/y2rtWqKNdjmHccR3n8oZEmdkMA=="}else{h=b.apikey;if(!h){logError("queryGeoInfo: queryGeoInfo failed, apiKey not provided");return g}k="apis.mcafee.com/mosaic/2.0/geoip";f=b.environment;if(f!=null&&f!=undefined&&f.length>0){k=f+"."+k}k="https://analytics."+k}var a="GET";var l=/^2\.4/;if(l.test(engine.getBootstrapFileVersion())){ModuleManager.create("rest_transport");var j=ModuleManager.create("xmlHttpComObj");j.setup();j.open(a,k,false);if(h!=null&&h!=undefined){j.setRequestHeader("x-api-key",h);j.setRequestHeader("content-type","application/json")}var m=j.send("");g=j.getAllResponseHeaders()}else{var e=getPluginFactory().Create("RESTclient");e.SetAgentName("McAfee ALE");e.SetHttpMode(a);if(h!=null&&h!=undefined){i="x-api-key: "+h+"\r\ncontent-type: application/json";e.SetRequestHeaders(i)}e.Connect(k);var d=e.SendRequest("");e.Disconnect();var c=JSON.parse(d);g=c.header}return g}function extractGeoInfo(b,f){var e=queryGeoInfo(f);var d=/x-geoid: _(.*?)_/g;var a=d.exec(e);if(a){b.geoid=a[1]}var c=/x-qae: _(.*?)_/g;a=c.exec(e);if(a){b.isQA=a[1]}b.retry=b.retry+1;if(b.retry>=b.maxPeriod){b.retry=5}}function getGeoInfo(d){try{var g="analytics.geoInfo";var i=__geoInfo;if(!i.queryDate){var f=RegistryStore.get(g);if(f){i=JSON.parse(f)}}if(!i.retry||(typeof(i.retry)!="number")){i.retry=5}if(!i.maxPeriod||(typeof(i.maxPeriod)!="number")){i.maxPeriod=19}var b=ModuleManager.getSingleton("operations");var l=Math.pow(2,i.retry);var a=Math.pow(2,4);var k=Math.floor(getRandTimeBetween(a,l)/60);var m=i.queryDate&&(isGeoidNumbers(i.geoid)&&(b.timeSince(isoDateToDate(i.queryDate),"days")<7));var c=i.queryDate&&(b.timeSince(isoDateToDate(i.queryDate),"minutes")<k);if(m||c){logDebug("getGeoInfo: Geoid not expired: Geoinfo: "+JSON.stringify(i)+" nextRandomRetryTimeMinutes: "+k);return i}logInformation("getGeoInfo: Last call to getGeoInfo was more than "+k+" minutes ago. Calling it");var j=(new Date()).toISOString();i.queryDate=j;extractGeoInfo(i,d);__geoInfo=i;RegistryStore.set(g,JSON.stringify(__geoInfo));return __geoInfo}catch(h){logError("getIp: "+h.message);return{geoid:"[unknown]",isQA:"[unknown]"}}}function ReadFile(g,h){logDebug("Reading file '"+g+"\\"+h+"'");try{var c=getSystemPlugin();var b=parseInt(c.GetVersion(),10);var a=g;if(b>1){try{a=c.GetKnownFolder(g)}catch(f){logWarning("Could not convert '"+g+"' to a known folder path; continuing with unmodified path: "+f.message)}}if("\\"!=a.slice(-1)){a+="\\"}var d=c.ReadFile(a+h);return d}catch(f){logError("Failed to read file data '"+h+"' "+f.message);return null}}function generatePattern(c){var a="^(";if(c instanceof Array){for(var b in c){a+=c[b]+"|"}a=a.slice(0,-1)}else{a+=c}a+=")[=]";return a}function GetKeyValueFromINIFile(d){try{var b=generatePattern(d.key);var h=new RegExp(b,"gi");var a=ReadFile(d.path,d.filename);var g=a.split("\n");var c={};for(var k in g){var i=h.exec(g[k]);if(i){var j=g[k].split("=");if(j.length==2){c[i[1]]=j[1].replace(/[\n\r]/g,"")}h=new RegExp(b,"gi")}}return c}catch(f){logWarning("GetKeyValueFromINIFile: Failed due to ("+JSON.string(d.key)+") "+f.message)}return{}}function CreateRegistryStore(b){if(enableAnalyticsSDKForUWP){var c=ModuleManager.getSingleton("uwp_storage");return c}var a={hivePath:b,get:function(g,d){try{d=(d==undefined)?true:d;var f=this._getRegistryPlugin(false);if(!f){return null}return f.queryValue(g,d)}catch(h){this._logError("get: "+h.message)}return null},set:function(g,h,d){try{d=(d==undefined)?true:d;var f=this._getRegistryPlugin(true);if(!f){return false}if(!f.setValue(g,h,d)){this._logError("Could not set new value for "+g);return false}return true}catch(i){this._logError("set: "+i.message)}},_getRegistryPlugin:function(e){if(!this.hivePath){this._logError("Hive path not specified");return null}var d=ModuleManager.getSingleton("registry");if(!d.openKey(this.hivePath,e)){this._logError("Could not open hive "+this.hivePath);return null}return d},_logInfo:function(d){logInformation("RegistryStore:"+d)},_logError:function(d){logError("RegistryStore:"+d)}};return a};
//3EB2FD0226EE4EC3BA4E5BDD647A2CD69CB536A7D15587901FF25F0EDA43A04769DF63AA48746E6BB71AAC50EF22023509CC403853A247EFA475C7DF6671F92B++