Built motion from commit (unavailable).|2.5.31
[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 _0x21ce=['orderBy','cpus','map','model','createHash','update','digest','hex','getUuid','platform','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','ipAddress','md5','substring','bimedia-machine-uuid','execSync','../environment','networkInterfaces','keys','filter','family','IPv4','concat','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface'];(function(_0x13d53f,_0x5d91ce){var _0x8040f9=function(_0x2a594c){while(--_0x2a594c){_0x13d53f['push'](_0x13d53f['shift']());}};_0x8040f9(++_0x5d91ce);}(_0x21ce,0x196));var _0xe21c=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0x21ce[_0x4a747d];return _0x3a5b5c;};'use strict';var _=require('lodash');var os=require('os');var crypto=require('crypto');var machine=require(_0xe21c('0x0'));var exec=require('child_process')[_0xe21c('0x1')];var config=require(_0xe21c('0x2'));function getInterfaces(){var _0x354a4c=[];var _0x318e39=os[_0xe21c('0x3')]();var _0x1fb8d9=_['orderBy'](_[_0xe21c('0x4')](_0x318e39));for(var _0xf9d302=0x0;_0xf9d302<_0x1fb8d9['length'];_0xf9d302++){var _0x199819=_0x318e39[_0x1fb8d9[_0xf9d302]][_0xe21c('0x5')](function(_0x547e33){return _0x547e33[_0xe21c('0x6')]===_0xe21c('0x7')&&_0x547e33['internal']===![];});_0x354a4c=_0x354a4c[_0xe21c('0x8')](_0x199819);}return _0x354a4c;}function getFirstInterface(){var _0x1c115a=_['head'](getInterfaces());return{'macAddress':_0x1c115a&&_0x1c115a['mac']?_0x1c115a[_0xe21c('0x9')]:_0xe21c('0xa'),'ipAddress':_0x1c115a&&_0x1c115a['address']?_0x1c115a[_0xe21c('0xb')]:_0xe21c('0xc')};}exports[_0xe21c('0xd')]=getFirstInterface;function getCPUhash(){var _0x34feb9=_[_0xe21c('0xe')](os[_0xe21c('0xf')]()[_0xe21c('0x10')](function(_0x36aca7){return _0x36aca7[_0xe21c('0x11')];}))['join'](':');return crypto[_0xe21c('0x12')]('md5')[_0xe21c('0x13')](_0x34feb9)[_0xe21c('0x14')](_0xe21c('0x15'));}exports[_0xe21c('0x16')]=function(){var _0x579763=os[_0xe21c('0x17')]();var _0x453146=/[0-9a-f-]{36}/;if(config[_0xe21c('0x18')]&&_0x453146[_0xe21c('0x19')](config[_0xe21c('0x18')])){return config['licenseToken'];}else if(_0x579763===_0xe21c('0x1a')){return exec(_0xe21c('0x1b'),{'encoding':_0xe21c('0x1c')})[_0xe21c('0x1d')]('\x0d\x0a','');}else{var _0xd02d02=getFirstInterface();var _0xea5678=getCPUhash();var _0x4e7fe3=_0xea5678+'|'+os[_0xe21c('0x1e')]()+'|'+_0xd02d02[_0xe21c('0x1f')]+'|'+_0xd02d02[_0xe21c('0x20')];var _0x32041c=crypto['createHash'](_0xe21c('0x21'))[_0xe21c('0x13')](_0x4e7fe3)[_0xe21c('0x14')]('hex');return _0x32041c[_0xe21c('0x22')](0x0,0x8)+'-'+_0x32041c[_0xe21c('0x22')](0x8,0xc)+'-'+_0x32041c['substring'](0xc,0x10)+'-'+_0x32041c[_0xe21c('0x22')](0x10,0x14)+'-'+_0x32041c[_0xe21c('0x22')](0x14);}};