Built motion from commit d5e4af8c.|2.6.23
[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 _0x97cb=['digest','hex','platform','test','licenseToken','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','update','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','networkInterfaces','orderBy','length','filter','IPv4','internal','concat','head','mac','address','getFirstInterface','cpus','map','model','join','createHash','md5'];(function(_0x51cc95,_0x11c31e){var _0x54fb8e=function(_0x50ea71){while(--_0x50ea71){_0x51cc95['push'](_0x51cc95['shift']());}};_0x54fb8e(++_0x11c31e);}(_0x97cb,0x11c));var _0xb97c=function(_0x11a3d9,_0x5db357){_0x11a3d9=_0x11a3d9-0x0;var _0x5c20e1=_0x97cb[_0x11a3d9];return _0x5c20e1;};'use strict';var _=require(_0xb97c('0x0'));var os=require('os');var crypto=require(_0xb97c('0x1'));var machine=require(_0xb97c('0x2'));var exec=require(_0xb97c('0x3'))[_0xb97c('0x4')];var config=require('../environment');function getInterfaces(){var _0x4e4431=[];var _0x8df631=os[_0xb97c('0x5')]();var _0x3913af=_[_0xb97c('0x6')](_['keys'](_0x8df631));for(var _0x446c2f=0x0;_0x446c2f<_0x3913af[_0xb97c('0x7')];_0x446c2f++){var _0x5945d5=_0x8df631[_0x3913af[_0x446c2f]][_0xb97c('0x8')](function(_0x1164fb){return _0x1164fb['family']===_0xb97c('0x9')&&_0x1164fb[_0xb97c('0xa')]===![];});_0x4e4431=_0x4e4431[_0xb97c('0xb')](_0x5945d5);}return _0x4e4431;}function getFirstInterface(){var _0x10e674=_[_0xb97c('0xc')](getInterfaces());return{'macAddress':_0x10e674&&_0x10e674[_0xb97c('0xd')]?_0x10e674[_0xb97c('0xd')]:'00:00:00:00:00:00','ipAddress':_0x10e674&&_0x10e674[_0xb97c('0xe')]?_0x10e674[_0xb97c('0xe')]:'127.0.0.1'};}exports[_0xb97c('0xf')]=getFirstInterface;function getCPUhash(){var _0x4af4a8=_['orderBy'](os[_0xb97c('0x10')]()[_0xb97c('0x11')](function(_0x36b785){return _0x36b785[_0xb97c('0x12')];}))[_0xb97c('0x13')](':');return crypto[_0xb97c('0x14')](_0xb97c('0x15'))['update'](_0x4af4a8)[_0xb97c('0x16')](_0xb97c('0x17'));}exports['getUuid']=function(){var _0x46ab5b=os[_0xb97c('0x18')]();var _0x4609bb=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x4609bb[_0xb97c('0x19')](config['licenseToken'])){return config[_0xb97c('0x1a')];}else if(_0x46ab5b==='win32'){return exec(_0xb97c('0x1b'),{'encoding':_0xb97c('0x1c')})[_0xb97c('0x1d')]('\x0d\x0a','');}else{var _0x587677=getFirstInterface();var _0x431a9e=getCPUhash();var _0x24d0ed=_0x431a9e+'|'+os[_0xb97c('0x1e')]()+'|'+_0x587677[_0xb97c('0x1f')]+'|'+_0x587677['ipAddress'];var _0x539876=crypto[_0xb97c('0x14')](_0xb97c('0x15'))[_0xb97c('0x20')](_0x24d0ed)[_0xb97c('0x16')](_0xb97c('0x17'));return _0x539876[_0xb97c('0x21')](0x0,0x8)+'-'+_0x539876['substring'](0x8,0xc)+'-'+_0x539876[_0xb97c('0x21')](0xc,0x10)+'-'+_0x539876['substring'](0x10,0x14)+'-'+_0x539876[_0xb97c('0x21')](0x14);}};