7be5d40bd5f7ea666bac03ac90d55c513a3bef8d
[motion2.git] / server / config / license / hardware.js
1 // *************************************************************************
2 // *                                                                       *
3 // * xCALLY Motion -  The Omnichannel Contact Center                       *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved                     *
5 // *                                                                       *
6 // *************************************************************************
7 // *                                                                       *
8 // * Email: info@xcally.com                                                *
9 // * Website: https://www.xcally.com                                       *
10 // *                                                                       *
11 // *************************************************************************
12 // *                                                                       *
13 // * The SOFTWARE PRODUCT is protected by copyright laws and international *
14 // * copyright treaties, as well as other intellectual property laws and   *
15 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                         *
16 // *                                                                       *
17 // *************************************************************************
18 var _0xadf5=['address','getFirstInterface','cpus','map','join','createHash','md5','update','hex','getUuid','platform','test','licenseToken','win32','dmidecode\x20--string\x20system-uuid','utf8','hostname','ipAddress','substring','lodash','bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces','orderBy','keys','length','filter','family','IPv4','internal','concat','mac','00:00:00:00:00:00'];(function(_0x2048ce,_0x455a8e){var _0x46d448=function(_0x5ca4aa){while(--_0x5ca4aa){_0x2048ce['push'](_0x2048ce['shift']());}};_0x46d448(++_0x455a8e);}(_0xadf5,0x12b));var _0x5adf=function(_0x515afd,_0x1a1e91){_0x515afd=_0x515afd-0x0;var _0x536d53=_0xadf5[_0x515afd];return _0x536d53;};'use strict';var _=require(_0x5adf('0x0'));var os=require('os');var crypto=require('crypto');var machine=require(_0x5adf('0x1'));var exec=require(_0x5adf('0x2'))[_0x5adf('0x3')];var config=require(_0x5adf('0x4'));function getInterfaces(){var _0x590059=[];var _0x1e7db5=os[_0x5adf('0x5')]();var _0x542191=_[_0x5adf('0x6')](_[_0x5adf('0x7')](_0x1e7db5));for(var _0x1af47f=0x0;_0x1af47f<_0x542191[_0x5adf('0x8')];_0x1af47f++){var _0xb5f6ff=_0x1e7db5[_0x542191[_0x1af47f]][_0x5adf('0x9')](function(_0x5be5da){return _0x5be5da[_0x5adf('0xa')]===_0x5adf('0xb')&&_0x5be5da[_0x5adf('0xc')]===![];});_0x590059=_0x590059[_0x5adf('0xd')](_0xb5f6ff);}return _0x590059;}function getFirstInterface(){var _0x5604bc=_['head'](getInterfaces());return{'macAddress':_0x5604bc&&_0x5604bc[_0x5adf('0xe')]?_0x5604bc[_0x5adf('0xe')]:_0x5adf('0xf'),'ipAddress':_0x5604bc&&_0x5604bc[_0x5adf('0x10')]?_0x5604bc[_0x5adf('0x10')]:'127.0.0.1'};}exports[_0x5adf('0x11')]=getFirstInterface;function getCPUhash(){var _0x35a3ec=_['orderBy'](os[_0x5adf('0x12')]()[_0x5adf('0x13')](function(_0x45cf0f){return _0x45cf0f['model'];}))[_0x5adf('0x14')](':');return crypto[_0x5adf('0x15')](_0x5adf('0x16'))[_0x5adf('0x17')](_0x35a3ec)['digest'](_0x5adf('0x18'));}exports[_0x5adf('0x19')]=function(){var _0x1b2cf3=os[_0x5adf('0x1a')]();var _0x496dde=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x496dde[_0x5adf('0x1b')](config[_0x5adf('0x1c')])){return config[_0x5adf('0x1c')];}else if(_0x1b2cf3===_0x5adf('0x1d')){return exec(_0x5adf('0x1e'),{'encoding':_0x5adf('0x1f')})['replace']('\x0d\x0a','');}else{var _0x48d228=getFirstInterface();var _0x16772e=getCPUhash();var _0x2376f3=_0x16772e+'|'+os[_0x5adf('0x20')]()+'|'+_0x48d228['macAddress']+'|'+_0x48d228[_0x5adf('0x21')];var _0x545d41=crypto[_0x5adf('0x15')]('md5')[_0x5adf('0x17')](_0x2376f3)['digest'](_0x5adf('0x18'));return _0x545d41[_0x5adf('0x22')](0x0,0x8)+'-'+_0x545d41[_0x5adf('0x22')](0x8,0xc)+'-'+_0x545d41['substring'](0xc,0x10)+'-'+_0x545d41['substring'](0x10,0x14)+'-'+_0x545d41['substring'](0x14);}};