c4959aa675b901bf66d61d100775464a32ef3eb1
[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 _0x7dc9=['concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','map','model','createHash','md5','update','digest','hex','getUuid','platform','licenseToken','test','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces','orderBy','keys','length','filter','family','IPv4'];(function(_0x18abd2,_0x22d4b3){var _0x1dcad6=function(_0xcc08c4){while(--_0xcc08c4){_0x18abd2['push'](_0x18abd2['shift']());}};_0x1dcad6(++_0x22d4b3);}(_0x7dc9,0x8b));var _0x97dc=function(_0x3f396b,_0x34c4ec){_0x3f396b=_0x3f396b-0x0;var _0xf1b023=_0x7dc9[_0x3f396b];return _0xf1b023;};'use strict';var _=require(_0x97dc('0x0'));var os=require('os');var crypto=require(_0x97dc('0x1'));var machine=require(_0x97dc('0x2'));var exec=require(_0x97dc('0x3'))[_0x97dc('0x4')];var config=require(_0x97dc('0x5'));function getInterfaces(){var _0x5bdd0d=[];var _0xf75c8e=os[_0x97dc('0x6')]();var _0x4e6b6b=_[_0x97dc('0x7')](_[_0x97dc('0x8')](_0xf75c8e));for(var _0x1e3ac2=0x0;_0x1e3ac2<_0x4e6b6b[_0x97dc('0x9')];_0x1e3ac2++){var _0x352ed0=_0xf75c8e[_0x4e6b6b[_0x1e3ac2]][_0x97dc('0xa')](function(_0x4856c9){return _0x4856c9[_0x97dc('0xb')]===_0x97dc('0xc')&&_0x4856c9['internal']===![];});_0x5bdd0d=_0x5bdd0d[_0x97dc('0xd')](_0x352ed0);}return _0x5bdd0d;}function getFirstInterface(){var _0x5516c1=_[_0x97dc('0xe')](getInterfaces());return{'macAddress':_0x5516c1&&_0x5516c1[_0x97dc('0xf')]?_0x5516c1[_0x97dc('0xf')]:_0x97dc('0x10'),'ipAddress':_0x5516c1&&_0x5516c1[_0x97dc('0x11')]?_0x5516c1[_0x97dc('0x11')]:_0x97dc('0x12')};}exports[_0x97dc('0x13')]=getFirstInterface;function getCPUhash(){var _0x2311d1=_[_0x97dc('0x7')](os[_0x97dc('0x14')]()[_0x97dc('0x15')](function(_0x442fe8){return _0x442fe8[_0x97dc('0x16')];}))['join'](':');return crypto[_0x97dc('0x17')](_0x97dc('0x18'))[_0x97dc('0x19')](_0x2311d1)[_0x97dc('0x1a')](_0x97dc('0x1b'));}exports[_0x97dc('0x1c')]=function(){var _0x2590f0=os[_0x97dc('0x1d')]();var _0x5e276d=/[0-9a-f-]{36}/;if(config[_0x97dc('0x1e')]&&_0x5e276d[_0x97dc('0x1f')](config[_0x97dc('0x1e')])){return config[_0x97dc('0x1e')];}else if(_0x2590f0==='win32'){return exec(_0x97dc('0x20'),{'encoding':_0x97dc('0x21')})[_0x97dc('0x22')]('\x0d\x0a','');}else{var _0x145e16=getFirstInterface();var _0x42741f=getCPUhash();var _0x2ffe18=_0x42741f+'|'+os[_0x97dc('0x23')]()+'|'+_0x145e16[_0x97dc('0x24')]+'|'+_0x145e16['ipAddress'];var _0x3dcff8=crypto['createHash'](_0x97dc('0x18'))[_0x97dc('0x19')](_0x2ffe18)[_0x97dc('0x1a')](_0x97dc('0x1b'));return _0x3dcff8[_0x97dc('0x25')](0x0,0x8)+'-'+_0x3dcff8[_0x97dc('0x25')](0x8,0xc)+'-'+_0x3dcff8[_0x97dc('0x25')](0xc,0x10)+'-'+_0x3dcff8['substring'](0x10,0x14)+'-'+_0x3dcff8['substring'](0x14);}};