Built motion from commit 616d3211.|2.6.4
[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 _0xf10a=['test','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','ipAddress','substring','lodash','crypto','child_process','execSync','networkInterfaces','orderBy','keys','length','filter','family','internal','concat','mac','00:00:00:00:00:00','address','127.0.0.1','map','model','join','createHash','md5','update','digest','hex','getUuid','platform','licenseToken'];(function(_0x32194f,_0x37117c){var _0x1b7559=function(_0x4c6f74){while(--_0x4c6f74){_0x32194f['push'](_0x32194f['shift']());}};_0x1b7559(++_0x37117c);}(_0xf10a,0x1dd));var _0xaf10=function(_0x52f1e6,_0xf70489){_0x52f1e6=_0x52f1e6-0x0;var _0x21f104=_0xf10a[_0x52f1e6];return _0x21f104;};'use strict';var _=require(_0xaf10('0x0'));var os=require('os');var crypto=require(_0xaf10('0x1'));var machine=require('bimedia-machine-uuid');var exec=require(_0xaf10('0x2'))[_0xaf10('0x3')];var config=require('../environment');function getInterfaces(){var _0x3e5dd4=[];var _0x392df9=os[_0xaf10('0x4')]();var _0x4ebd46=_[_0xaf10('0x5')](_[_0xaf10('0x6')](_0x392df9));for(var _0x4b2579=0x0;_0x4b2579<_0x4ebd46[_0xaf10('0x7')];_0x4b2579++){var _0x1b312c=_0x392df9[_0x4ebd46[_0x4b2579]][_0xaf10('0x8')](function(_0x352eb5){return _0x352eb5[_0xaf10('0x9')]==='IPv4'&&_0x352eb5[_0xaf10('0xa')]===![];});_0x3e5dd4=_0x3e5dd4[_0xaf10('0xb')](_0x1b312c);}return _0x3e5dd4;}function getFirstInterface(){var _0x466c0a=_['head'](getInterfaces());return{'macAddress':_0x466c0a&&_0x466c0a[_0xaf10('0xc')]?_0x466c0a[_0xaf10('0xc')]:_0xaf10('0xd'),'ipAddress':_0x466c0a&&_0x466c0a['address']?_0x466c0a[_0xaf10('0xe')]:_0xaf10('0xf')};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x3becc1=_[_0xaf10('0x5')](os['cpus']()[_0xaf10('0x10')](function(_0x195148){return _0x195148[_0xaf10('0x11')];}))[_0xaf10('0x12')](':');return crypto[_0xaf10('0x13')](_0xaf10('0x14'))[_0xaf10('0x15')](_0x3becc1)[_0xaf10('0x16')](_0xaf10('0x17'));}exports[_0xaf10('0x18')]=function(){var _0x5c6ad0=os[_0xaf10('0x19')]();var _0x577331=/[0-9a-f-]{36}/;if(config[_0xaf10('0x1a')]&&_0x577331[_0xaf10('0x1b')](config[_0xaf10('0x1a')])){return config[_0xaf10('0x1a')];}else if(_0x5c6ad0===_0xaf10('0x1c')){return exec(_0xaf10('0x1d'),{'encoding':_0xaf10('0x1e')})[_0xaf10('0x1f')]('\x0d\x0a','');}else{var _0x2d687e=getFirstInterface();var _0x56c735=getCPUhash();var _0x28dd7a=_0x56c735+'|'+os[_0xaf10('0x20')]()+'|'+_0x2d687e[_0xaf10('0x21')]+'|'+_0x2d687e[_0xaf10('0x22')];var _0x31b520=crypto[_0xaf10('0x13')](_0xaf10('0x14'))['update'](_0x28dd7a)['digest']('hex');return _0x31b520[_0xaf10('0x23')](0x0,0x8)+'-'+_0x31b520[_0xaf10('0x23')](0x8,0xc)+'-'+_0x31b520[_0xaf10('0x23')](0xc,0x10)+'-'+_0x31b520[_0xaf10('0x23')](0x10,0x14)+'-'+_0x31b520[_0xaf10('0x23')](0x14);}};