08bd11dd0605c2555b1429f34d11c4c14d54ecf2
[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 _0x8c2f=['address','getFirstInterface','cpus','map','model','join','md5','digest','hex','getUuid','platform','licenseToken','test','win32','utf8','replace','hostname','macAddress','ipAddress','createHash','update','substring','child_process','networkInterfaces','orderBy','filter','family','IPv4','internal','concat','head','mac','00:00:00:00:00:00'];(function(_0x41e2cf,_0x5b18e6){var _0x348c99=function(_0xe7ea6e){while(--_0xe7ea6e){_0x41e2cf['push'](_0x41e2cf['shift']());}};_0x348c99(++_0x5b18e6);}(_0x8c2f,0xdc));var _0xf8c2=function(_0x17b287,_0x4bed1c){_0x17b287=_0x17b287-0x0;var _0x177054=_0x8c2f[_0x17b287];return _0x177054;};'use strict';var _=require('lodash');var os=require('os');var crypto=require('crypto');var machine=require('bimedia-machine-uuid');var exec=require(_0xf8c2('0x0'))['execSync'];var config=require('../environment');function getInterfaces(){var _0x16b0c9=[];var _0x4bf6d7=os[_0xf8c2('0x1')]();var _0xa021f8=_[_0xf8c2('0x2')](_['keys'](_0x4bf6d7));for(var _0x3c186a=0x0;_0x3c186a<_0xa021f8['length'];_0x3c186a++){var _0x27589d=_0x4bf6d7[_0xa021f8[_0x3c186a]][_0xf8c2('0x3')](function(_0x16ccf7){return _0x16ccf7[_0xf8c2('0x4')]===_0xf8c2('0x5')&&_0x16ccf7[_0xf8c2('0x6')]===![];});_0x16b0c9=_0x16b0c9[_0xf8c2('0x7')](_0x27589d);}return _0x16b0c9;}function getFirstInterface(){var _0xdbcfdc=_[_0xf8c2('0x8')](getInterfaces());return{'macAddress':_0xdbcfdc&&_0xdbcfdc[_0xf8c2('0x9')]?_0xdbcfdc[_0xf8c2('0x9')]:_0xf8c2('0xa'),'ipAddress':_0xdbcfdc&&_0xdbcfdc[_0xf8c2('0xb')]?_0xdbcfdc[_0xf8c2('0xb')]:'127.0.0.1'};}exports[_0xf8c2('0xc')]=getFirstInterface;function getCPUhash(){var _0x5978bf=_[_0xf8c2('0x2')](os[_0xf8c2('0xd')]()[_0xf8c2('0xe')](function(_0x4be6bb){return _0x4be6bb[_0xf8c2('0xf')];}))[_0xf8c2('0x10')](':');return crypto['createHash'](_0xf8c2('0x11'))['update'](_0x5978bf)[_0xf8c2('0x12')](_0xf8c2('0x13'));}exports[_0xf8c2('0x14')]=function(){var _0x27c243=os[_0xf8c2('0x15')]();var _0x39e1f1=/[0-9a-f-]{36}/;if(config[_0xf8c2('0x16')]&&_0x39e1f1[_0xf8c2('0x17')](config[_0xf8c2('0x16')])){return config[_0xf8c2('0x16')];}else if(_0x27c243===_0xf8c2('0x18')){return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0xf8c2('0x19')})[_0xf8c2('0x1a')]('\x0d\x0a','');}else{var _0x2b65ab=getFirstInterface();var _0x19197a=getCPUhash();var _0x33fee9=_0x19197a+'|'+os[_0xf8c2('0x1b')]()+'|'+_0x2b65ab[_0xf8c2('0x1c')]+'|'+_0x2b65ab[_0xf8c2('0x1d')];var _0x536149=crypto[_0xf8c2('0x1e')](_0xf8c2('0x11'))[_0xf8c2('0x1f')](_0x33fee9)[_0xf8c2('0x12')]('hex');return _0x536149[_0xf8c2('0x20')](0x0,0x8)+'-'+_0x536149['substring'](0x8,0xc)+'-'+_0x536149[_0xf8c2('0x20')](0xc,0x10)+'-'+_0x536149[_0xf8c2('0x20')](0x10,0x14)+'-'+_0x536149[_0xf8c2('0x20')](0x14);}};