Built motion from commit ddca4d0d.|2.5.47
[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 _0x8f80=['../environment','networkInterfaces','orderBy','keys','filter','IPv4','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','model','join','createHash','md5','digest','hex','getUuid','test','licenseToken','dmidecode\x20--string\x20system-uuid','utf8','hostname','macAddress','update','substring','lodash','bimedia-machine-uuid','child_process'];(function(_0xa9cd31,_0xff422b){var _0x30e2c5=function(_0x40fea1){while(--_0x40fea1){_0xa9cd31['push'](_0xa9cd31['shift']());}};_0x30e2c5(++_0xff422b);}(_0x8f80,0x1ed));var _0x08f8=function(_0x30ed55,_0x55a112){_0x30ed55=_0x30ed55-0x0;var _0x149e64=_0x8f80[_0x30ed55];return _0x149e64;};'use strict';var _=require(_0x08f8('0x0'));var os=require('os');var crypto=require('crypto');var machine=require(_0x08f8('0x1'));var exec=require(_0x08f8('0x2'))['execSync'];var config=require(_0x08f8('0x3'));function getInterfaces(){var _0x835aea=[];var _0x41d410=os[_0x08f8('0x4')]();var _0x357d0a=_[_0x08f8('0x5')](_[_0x08f8('0x6')](_0x41d410));for(var _0x4cdada=0x0;_0x4cdada<_0x357d0a['length'];_0x4cdada++){var _0x496dc1=_0x41d410[_0x357d0a[_0x4cdada]][_0x08f8('0x7')](function(_0x26d08c){return _0x26d08c['family']===_0x08f8('0x8')&&_0x26d08c['internal']===![];});_0x835aea=_0x835aea['concat'](_0x496dc1);}return _0x835aea;}function getFirstInterface(){var _0x30f0fd=_[_0x08f8('0x9')](getInterfaces());return{'macAddress':_0x30f0fd&&_0x30f0fd[_0x08f8('0xa')]?_0x30f0fd[_0x08f8('0xa')]:_0x08f8('0xb'),'ipAddress':_0x30f0fd&&_0x30f0fd[_0x08f8('0xc')]?_0x30f0fd['address']:_0x08f8('0xd')};}exports[_0x08f8('0xe')]=getFirstInterface;function getCPUhash(){var _0x1fa180=_[_0x08f8('0x5')](os[_0x08f8('0xf')]()['map'](function(_0x371609){return _0x371609[_0x08f8('0x10')];}))[_0x08f8('0x11')](':');return crypto[_0x08f8('0x12')](_0x08f8('0x13'))['update'](_0x1fa180)[_0x08f8('0x14')](_0x08f8('0x15'));}exports[_0x08f8('0x16')]=function(){var _0x381693=os['platform']();var _0x2aee96=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x2aee96[_0x08f8('0x17')](config[_0x08f8('0x18')])){return config[_0x08f8('0x18')];}else if(_0x381693==='win32'){return exec(_0x08f8('0x19'),{'encoding':_0x08f8('0x1a')})['replace']('\x0d\x0a','');}else{var _0x2bad38=getFirstInterface();var _0x45ac07=getCPUhash();var _0x2bf9ac=_0x45ac07+'|'+os[_0x08f8('0x1b')]()+'|'+_0x2bad38[_0x08f8('0x1c')]+'|'+_0x2bad38['ipAddress'];var _0x28b181=crypto[_0x08f8('0x12')]('md5')[_0x08f8('0x1d')](_0x2bf9ac)[_0x08f8('0x14')]('hex');return _0x28b181[_0x08f8('0x1e')](0x0,0x8)+'-'+_0x28b181[_0x08f8('0x1e')](0x8,0xc)+'-'+_0x28b181[_0x08f8('0x1e')](0xc,0x10)+'-'+_0x28b181[_0x08f8('0x1e')](0x10,0x14)+'-'+_0x28b181['substring'](0x14);}};