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 _0x9b75=['keys','length','filter','IPv4','internal','concat','head','mac','00:00:00:00:00:00','127.0.0.1','getFirstInterface','cpus','map','join','createHash','md5','update','digest','getUuid','platform','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','hostname','macAddress','hex','substring','lodash','bimedia-machine-uuid','execSync','orderBy'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x9b75,0x15c));var _0x59b7=function(_0x440a3a,_0x31beee){_0x440a3a=_0x440a3a-0x0;var _0x497ee0=_0x9b75[_0x440a3a];return _0x497ee0;};'use strict';var _=require(_0x59b7('0x0'));var os=require('os');var crypto=require('crypto');var machine=require(_0x59b7('0x1'));var exec=require('child_process')[_0x59b7('0x2')];var config=require('../environment');function getInterfaces(){var _0x451e2a=[];var _0x5b9c08=os['networkInterfaces']();var _0x247f86=_[_0x59b7('0x3')](_[_0x59b7('0x4')](_0x5b9c08));for(var _0x314887=0x0;_0x314887<_0x247f86[_0x59b7('0x5')];_0x314887++){var _0x17890a=_0x5b9c08[_0x247f86[_0x314887]][_0x59b7('0x6')](function(_0x565172){return _0x565172['family']===_0x59b7('0x7')&&_0x565172[_0x59b7('0x8')]===![];});_0x451e2a=_0x451e2a[_0x59b7('0x9')](_0x17890a);}return _0x451e2a;}function getFirstInterface(){var _0x252b74=_[_0x59b7('0xa')](getInterfaces());return{'macAddress':_0x252b74&&_0x252b74[_0x59b7('0xb')]?_0x252b74[_0x59b7('0xb')]:_0x59b7('0xc'),'ipAddress':_0x252b74&&_0x252b74['address']?_0x252b74['address']:_0x59b7('0xd')};}exports[_0x59b7('0xe')]=getFirstInterface;function getCPUhash(){var _0x2a7165=_[_0x59b7('0x3')](os[_0x59b7('0xf')]()[_0x59b7('0x10')](function(_0x5c2657){return _0x5c2657['model'];}))[_0x59b7('0x11')](':');return crypto[_0x59b7('0x12')](_0x59b7('0x13'))[_0x59b7('0x14')](_0x2a7165)[_0x59b7('0x15')]('hex');}exports[_0x59b7('0x16')]=function(){var _0x12969d=os[_0x59b7('0x17')]();var _0x1d49cd=/[0-9a-f-]{36}/;if(config[_0x59b7('0x18')]&&_0x1d49cd[_0x59b7('0x19')](config[_0x59b7('0x18')])){return config[_0x59b7('0x18')];}else if(_0x12969d===_0x59b7('0x1a')){return exec(_0x59b7('0x1b'),{'encoding':'utf8'})['replace']('\x0d\x0a','');}else{var _0x524e76=getFirstInterface();var _0xa8a94a=getCPUhash();var _0x2770cd=_0xa8a94a+'|'+os[_0x59b7('0x1c')]()+'|'+_0x524e76[_0x59b7('0x1d')]+'|'+_0x524e76['ipAddress'];var _0x354d22=crypto[_0x59b7('0x12')](_0x59b7('0x13'))[_0x59b7('0x14')](_0x2770cd)['digest'](_0x59b7('0x1e'));return _0x354d22['substring'](0x0,0x8)+'-'+_0x354d22['substring'](0x8,0xc)+'-'+_0x354d22['substring'](0xc,0x10)+'-'+_0x354d22[_0x59b7('0x1f')](0x10,0x14)+'-'+_0x354d22['substring'](0x14);}};