Built motion from commit 5ba5b610.|2.5.33
[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 _0xc262=['getUuid','platform','test','licenseToken','win32','dmidecode\x20--string\x20system-uuid','replace','macAddress','ipAddress','md5','substring','lodash','crypto','bimedia-machine-uuid','child_process','../environment','networkInterfaces','length','family','internal','mac','address','127.0.0.1','getFirstInterface','orderBy','cpus','map','model','join','createHash','update','digest','hex'];(function(_0x4a2193,_0x312076){var _0x634e78=function(_0x35b0b7){while(--_0x35b0b7){_0x4a2193['push'](_0x4a2193['shift']());}};_0x634e78(++_0x312076);}(_0xc262,0x1d9));var _0x2c26=function(_0x2d0b84,_0x34682d){_0x2d0b84=_0x2d0b84-0x0;var _0x8d0088=_0xc262[_0x2d0b84];return _0x8d0088;};'use strict';var _=require(_0x2c26('0x0'));var os=require('os');var crypto=require(_0x2c26('0x1'));var machine=require(_0x2c26('0x2'));var exec=require(_0x2c26('0x3'))['execSync'];var config=require(_0x2c26('0x4'));function getInterfaces(){var _0x638d2f=[];var _0x3e4395=os[_0x2c26('0x5')]();var _0x3027d8=_['orderBy'](_['keys'](_0x3e4395));for(var _0x1f068d=0x0;_0x1f068d<_0x3027d8[_0x2c26('0x6')];_0x1f068d++){var _0x3ee65c=_0x3e4395[_0x3027d8[_0x1f068d]]['filter'](function(_0x5071ff){return _0x5071ff[_0x2c26('0x7')]==='IPv4'&&_0x5071ff[_0x2c26('0x8')]===![];});_0x638d2f=_0x638d2f['concat'](_0x3ee65c);}return _0x638d2f;}function getFirstInterface(){var _0x16d728=_['head'](getInterfaces());return{'macAddress':_0x16d728&&_0x16d728[_0x2c26('0x9')]?_0x16d728['mac']:'00:00:00:00:00:00','ipAddress':_0x16d728&&_0x16d728[_0x2c26('0xa')]?_0x16d728['address']:_0x2c26('0xb')};}exports[_0x2c26('0xc')]=getFirstInterface;function getCPUhash(){var _0x30959b=_[_0x2c26('0xd')](os[_0x2c26('0xe')]()[_0x2c26('0xf')](function(_0x385781){return _0x385781[_0x2c26('0x10')];}))[_0x2c26('0x11')](':');return crypto[_0x2c26('0x12')]('md5')[_0x2c26('0x13')](_0x30959b)[_0x2c26('0x14')](_0x2c26('0x15'));}exports[_0x2c26('0x16')]=function(){var _0x3444d5=os[_0x2c26('0x17')]();var _0x1a4eec=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x1a4eec[_0x2c26('0x18')](config['licenseToken'])){return config[_0x2c26('0x19')];}else if(_0x3444d5===_0x2c26('0x1a')){return exec(_0x2c26('0x1b'),{'encoding':'utf8'})[_0x2c26('0x1c')]('\x0d\x0a','');}else{var _0x23b691=getFirstInterface();var _0x2c1e31=getCPUhash();var _0x435086=_0x2c1e31+'|'+os['hostname']()+'|'+_0x23b691[_0x2c26('0x1d')]+'|'+_0x23b691[_0x2c26('0x1e')];var _0x1183e0=crypto[_0x2c26('0x12')](_0x2c26('0x1f'))[_0x2c26('0x13')](_0x435086)['digest'](_0x2c26('0x15'));return _0x1183e0['substring'](0x0,0x8)+'-'+_0x1183e0['substring'](0x8,0xc)+'-'+_0x1183e0[_0x2c26('0x20')](0xc,0x10)+'-'+_0x1183e0['substring'](0x10,0x14)+'-'+_0x1183e0[_0x2c26('0x20')](0x14);}};