09ba0a38280a2b7439add3a001a30336939fab17
[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 _0xc4ea=['substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces','orderBy','length','filter','family','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','model','createHash','update','hex','getUuid','platform','test','licenseToken','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','ipAddress','md5','digest'];(function(_0x29b90f,_0x1f6cb5){var _0x5672d1=function(_0x1d1dea){while(--_0x1d1dea){_0x29b90f['push'](_0x29b90f['shift']());}};_0x5672d1(++_0x1f6cb5);}(_0xc4ea,0xdf));var _0xac4e=function(_0x35bd45,_0x16b749){_0x35bd45=_0x35bd45-0x0;var _0x403334=_0xc4ea[_0x35bd45];return _0x403334;};'use strict';var _=require(_0xac4e('0x0'));var os=require('os');var crypto=require(_0xac4e('0x1'));var machine=require(_0xac4e('0x2'));var exec=require(_0xac4e('0x3'))[_0xac4e('0x4')];var config=require(_0xac4e('0x5'));function getInterfaces(){var _0x52bca1=[];var _0x3d975c=os[_0xac4e('0x6')]();var _0x2884ee=_[_0xac4e('0x7')](_['keys'](_0x3d975c));for(var _0xb9afcf=0x0;_0xb9afcf<_0x2884ee[_0xac4e('0x8')];_0xb9afcf++){var _0xcfe73b=_0x3d975c[_0x2884ee[_0xb9afcf]][_0xac4e('0x9')](function(_0x62b59b){return _0x62b59b[_0xac4e('0xa')]==='IPv4'&&_0x62b59b['internal']===![];});_0x52bca1=_0x52bca1[_0xac4e('0xb')](_0xcfe73b);}return _0x52bca1;}function getFirstInterface(){var _0x2b6c48=_[_0xac4e('0xc')](getInterfaces());return{'macAddress':_0x2b6c48&&_0x2b6c48[_0xac4e('0xd')]?_0x2b6c48[_0xac4e('0xd')]:_0xac4e('0xe'),'ipAddress':_0x2b6c48&&_0x2b6c48[_0xac4e('0xf')]?_0x2b6c48[_0xac4e('0xf')]:_0xac4e('0x10')};}exports[_0xac4e('0x11')]=getFirstInterface;function getCPUhash(){var _0x33aff7=_[_0xac4e('0x7')](os[_0xac4e('0x12')]()['map'](function(_0x20571d){return _0x20571d[_0xac4e('0x13')];}))['join'](':');return crypto[_0xac4e('0x14')]('md5')[_0xac4e('0x15')](_0x33aff7)['digest'](_0xac4e('0x16'));}exports[_0xac4e('0x17')]=function(){var _0x2bbdf8=os[_0xac4e('0x18')]();var _0x58f6a0=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x58f6a0[_0xac4e('0x19')](config['licenseToken'])){return config[_0xac4e('0x1a')];}else if(_0x2bbdf8===_0xac4e('0x1b')){return exec(_0xac4e('0x1c'),{'encoding':_0xac4e('0x1d')})[_0xac4e('0x1e')]('\x0d\x0a','');}else{var _0xeca23e=getFirstInterface();var _0x4dc05e=getCPUhash();var _0x4f5bfc=_0x4dc05e+'|'+os[_0xac4e('0x1f')]()+'|'+_0xeca23e[_0xac4e('0x20')]+'|'+_0xeca23e[_0xac4e('0x21')];var _0xa10ccc=crypto[_0xac4e('0x14')](_0xac4e('0x22'))['update'](_0x4f5bfc)[_0xac4e('0x23')](_0xac4e('0x16'));return _0xa10ccc[_0xac4e('0x24')](0x0,0x8)+'-'+_0xa10ccc[_0xac4e('0x24')](0x8,0xc)+'-'+_0xa10ccc[_0xac4e('0x24')](0xc,0x10)+'-'+_0xa10ccc[_0xac4e('0x24')](0x10,0x14)+'-'+_0xa10ccc[_0xac4e('0x24')](0x14);}};