a757effc3e8632150a08b5917b63b307ff2d5c0f
[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 _0xa24c=['createHash','md5','update','platform','test','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','ipAddress','digest','hex','substring','lodash','bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces','keys','length','filter','family','internal','head','mac','00:00:00:00:00:00','address','127.0.0.1','orderBy','map','model'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0xa24c,0x1bb));var _0xca24=function(_0x3e4566,_0x378e21){_0x3e4566=_0x3e4566-0x0;var _0x29c854=_0xa24c[_0x3e4566];return _0x29c854;};'use strict';var _=require(_0xca24('0x0'));var os=require('os');var crypto=require('crypto');var machine=require(_0xca24('0x1'));var exec=require(_0xca24('0x2'))[_0xca24('0x3')];var config=require(_0xca24('0x4'));function getInterfaces(){var _0x3daa9f=[];var _0x5e7d5c=os[_0xca24('0x5')]();var _0x3fa581=_['orderBy'](_[_0xca24('0x6')](_0x5e7d5c));for(var _0xf8e3cc=0x0;_0xf8e3cc<_0x3fa581[_0xca24('0x7')];_0xf8e3cc++){var _0x17e6f6=_0x5e7d5c[_0x3fa581[_0xf8e3cc]][_0xca24('0x8')](function(_0x4eacb3){return _0x4eacb3[_0xca24('0x9')]==='IPv4'&&_0x4eacb3[_0xca24('0xa')]===![];});_0x3daa9f=_0x3daa9f['concat'](_0x17e6f6);}return _0x3daa9f;}function getFirstInterface(){var _0x9e1c5=_[_0xca24('0xb')](getInterfaces());return{'macAddress':_0x9e1c5&&_0x9e1c5[_0xca24('0xc')]?_0x9e1c5['mac']:_0xca24('0xd'),'ipAddress':_0x9e1c5&&_0x9e1c5[_0xca24('0xe')]?_0x9e1c5['address']:_0xca24('0xf')};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x594037=_[_0xca24('0x10')](os['cpus']()[_0xca24('0x11')](function(_0x44184e){return _0x44184e[_0xca24('0x12')];}))['join'](':');return crypto[_0xca24('0x13')](_0xca24('0x14'))[_0xca24('0x15')](_0x594037)['digest']('hex');}exports['getUuid']=function(){var _0x18fe4c=os[_0xca24('0x16')]();var _0x7d2fea=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x7d2fea[_0xca24('0x17')](config['licenseToken'])){return config['licenseToken'];}else if(_0x18fe4c===_0xca24('0x18')){return exec(_0xca24('0x19'),{'encoding':_0xca24('0x1a')})[_0xca24('0x1b')]('\x0d\x0a','');}else{var _0x5e8a0e=getFirstInterface();var _0x3d8b9e=getCPUhash();var _0x56a82f=_0x3d8b9e+'|'+os[_0xca24('0x1c')]()+'|'+_0x5e8a0e['macAddress']+'|'+_0x5e8a0e[_0xca24('0x1d')];var _0x53fbe9=crypto['createHash'](_0xca24('0x14'))['update'](_0x56a82f)[_0xca24('0x1e')](_0xca24('0x1f'));return _0x53fbe9[_0xca24('0x20')](0x0,0x8)+'-'+_0x53fbe9[_0xca24('0x20')](0x8,0xc)+'-'+_0x53fbe9[_0xca24('0x20')](0xc,0x10)+'-'+_0x53fbe9['substring'](0x10,0x14)+'-'+_0x53fbe9[_0xca24('0x20')](0x14);}};