Built motion from commit f623a78c.|2.6.31
[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 _0x926f=['address','getFirstInterface','orderBy','cpus','map','model','join','md5','update','digest','platform','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','ipAddress','createHash','hex','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces','keys','filter','family','IPv4','internal','concat','mac','00:00:00:00:00:00'];(function(_0x2ed6ae,_0x4f257d){var _0x2461a0=function(_0x29a292){while(--_0x29a292){_0x2ed6ae['push'](_0x2ed6ae['shift']());}};_0x2461a0(++_0x4f257d);}(_0x926f,0xa5));var _0xf926=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x926f[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xf926('0x0'));var os=require('os');var crypto=require(_0xf926('0x1'));var machine=require(_0xf926('0x2'));var exec=require(_0xf926('0x3'))[_0xf926('0x4')];var config=require(_0xf926('0x5'));function getInterfaces(){var _0x577dd4=[];var _0x5396b6=os[_0xf926('0x6')]();var _0x55b89c=_['orderBy'](_[_0xf926('0x7')](_0x5396b6));for(var _0x1c9db7=0x0;_0x1c9db7<_0x55b89c['length'];_0x1c9db7++){var _0x4d6043=_0x5396b6[_0x55b89c[_0x1c9db7]][_0xf926('0x8')](function(_0x358563){return _0x358563[_0xf926('0x9')]===_0xf926('0xa')&&_0x358563[_0xf926('0xb')]===![];});_0x577dd4=_0x577dd4[_0xf926('0xc')](_0x4d6043);}return _0x577dd4;}function getFirstInterface(){var _0x49b905=_['head'](getInterfaces());return{'macAddress':_0x49b905&&_0x49b905[_0xf926('0xd')]?_0x49b905['mac']:_0xf926('0xe'),'ipAddress':_0x49b905&&_0x49b905['address']?_0x49b905[_0xf926('0xf')]:'127.0.0.1'};}exports[_0xf926('0x10')]=getFirstInterface;function getCPUhash(){var _0x855dbd=_[_0xf926('0x11')](os[_0xf926('0x12')]()[_0xf926('0x13')](function(_0x54258a){return _0x54258a[_0xf926('0x14')];}))[_0xf926('0x15')](':');return crypto['createHash'](_0xf926('0x16'))[_0xf926('0x17')](_0x855dbd)[_0xf926('0x18')]('hex');}exports['getUuid']=function(){var _0x27f23d=os[_0xf926('0x19')]();var _0xf10c4a=/[0-9a-f-]{36}/;if(config[_0xf926('0x1a')]&&_0xf10c4a[_0xf926('0x1b')](config[_0xf926('0x1a')])){return config[_0xf926('0x1a')];}else if(_0x27f23d===_0xf926('0x1c')){return exec(_0xf926('0x1d'),{'encoding':_0xf926('0x1e')})[_0xf926('0x1f')]('\x0d\x0a','');}else{var _0x3905bb=getFirstInterface();var _0x3f7715=getCPUhash();var _0x17b4b1=_0x3f7715+'|'+os['hostname']()+'|'+_0x3905bb['macAddress']+'|'+_0x3905bb[_0xf926('0x20')];var _0x1acffe=crypto[_0xf926('0x21')](_0xf926('0x16'))['update'](_0x17b4b1)['digest'](_0xf926('0x22'));return _0x1acffe[_0xf926('0x23')](0x0,0x8)+'-'+_0x1acffe['substring'](0x8,0xc)+'-'+_0x1acffe[_0xf926('0x23')](0xc,0x10)+'-'+_0x1acffe[_0xf926('0x23')](0x10,0x14)+'-'+_0x1acffe['substring'](0x14);}};