9fa94178cb9fadfc002792a53b0cee3de70b916b
[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 _0xd925=['filter','family','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','map','model','join','createHash','update','digest','getUuid','platform','licenseToken','win32','dmidecode\x20--string\x20system-uuid','utf8','macAddress','ipAddress','md5','hex','substring','lodash','crypto','execSync','../environment','networkInterfaces','orderBy','keys','length'];(function(_0xf0bcac,_0x531755){var _0x4e4c65=function(_0x35a77a){while(--_0x35a77a){_0xf0bcac['push'](_0xf0bcac['shift']());}};_0x4e4c65(++_0x531755);}(_0xd925,0xed));var _0x5d92=function(_0x51f5a6,_0x4cdf08){_0x51f5a6=_0x51f5a6-0x0;var _0x3f318f=_0xd925[_0x51f5a6];return _0x3f318f;};'use strict';var _=require(_0x5d92('0x0'));var os=require('os');var crypto=require(_0x5d92('0x1'));var machine=require('bimedia-machine-uuid');var exec=require('child_process')[_0x5d92('0x2')];var config=require(_0x5d92('0x3'));function getInterfaces(){var _0x4f2463=[];var _0x32f691=os[_0x5d92('0x4')]();var _0x40f2c9=_[_0x5d92('0x5')](_[_0x5d92('0x6')](_0x32f691));for(var _0x492554=0x0;_0x492554<_0x40f2c9[_0x5d92('0x7')];_0x492554++){var _0x583bf4=_0x32f691[_0x40f2c9[_0x492554]][_0x5d92('0x8')](function(_0x4ad363){return _0x4ad363[_0x5d92('0x9')]==='IPv4'&&_0x4ad363['internal']===![];});_0x4f2463=_0x4f2463[_0x5d92('0xa')](_0x583bf4);}return _0x4f2463;}function getFirstInterface(){var _0x263183=_[_0x5d92('0xb')](getInterfaces());return{'macAddress':_0x263183&&_0x263183[_0x5d92('0xc')]?_0x263183[_0x5d92('0xc')]:_0x5d92('0xd'),'ipAddress':_0x263183&&_0x263183[_0x5d92('0xe')]?_0x263183[_0x5d92('0xe')]:_0x5d92('0xf')};}exports[_0x5d92('0x10')]=getFirstInterface;function getCPUhash(){var _0xb340ef=_[_0x5d92('0x5')](os[_0x5d92('0x11')]()[_0x5d92('0x12')](function(_0x39cb36){return _0x39cb36[_0x5d92('0x13')];}))[_0x5d92('0x14')](':');return crypto[_0x5d92('0x15')]('md5')[_0x5d92('0x16')](_0xb340ef)[_0x5d92('0x17')]('hex');}exports[_0x5d92('0x18')]=function(){var _0xccbd09=os[_0x5d92('0x19')]();var _0x513d4=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x513d4['test'](config[_0x5d92('0x1a')])){return config[_0x5d92('0x1a')];}else if(_0xccbd09===_0x5d92('0x1b')){return exec(_0x5d92('0x1c'),{'encoding':_0x5d92('0x1d')})['replace']('\x0d\x0a','');}else{var _0x24755b=getFirstInterface();var _0x23fe57=getCPUhash();var _0x277971=_0x23fe57+'|'+os['hostname']()+'|'+_0x24755b[_0x5d92('0x1e')]+'|'+_0x24755b[_0x5d92('0x1f')];var _0x10f05b=crypto[_0x5d92('0x15')](_0x5d92('0x20'))['update'](_0x277971)[_0x5d92('0x17')](_0x5d92('0x21'));return _0x10f05b['substring'](0x0,0x8)+'-'+_0x10f05b[_0x5d92('0x22')](0x8,0xc)+'-'+_0x10f05b[_0x5d92('0x22')](0xc,0x10)+'-'+_0x10f05b[_0x5d92('0x22')](0x10,0x14)+'-'+_0x10f05b[_0x5d92('0x22')](0x14);}};